-
Notifications
You must be signed in to change notification settings - Fork 158
chore(customrawdb): delete customrawdb package and switch to avalanchego imports #1319
base: master
Are you sure you want to change the base?
Changes from 21 commits
79648df
2af6d7c
a11cfcc
dd36d2f
faad5d5
375c1b0
4252f36
eb25364
b5c8955
d1ba0fe
950c6f0
a757302
7869716
56963ea
214141d
327cee4
44e841d
6ef6e9a
c0266f7
fe604ac
755fda0
f75c4da
428048f
02d6a4a
5ee68ce
453a924
5f0a462
861d8f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I defer to @ceyonur for this, but I think we should avoid making unnecessary changes in this package.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes were needed, because the test broke, but I also addressed some stylistic comments from @JonathanOppenheimer
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah minimal changes are ok, but I don't think you should make the stylistic changes he suggested |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -961,21 +961,23 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc | |
| defer release() | ||
|
|
||
| h := block.Header() | ||
| // Apply block number override fix before creating block context so GetHashFn | ||
| // can correctly resolve blockhash(n) when block number is overridden to n+1. | ||
| if config != nil && config.BlockOverrides != nil && config.BlockOverrides.Number.ToInt().Uint64() == h.Number.Uint64()+1 { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this change necessary? What does it do? I suspect you have may have found a solution to a persistent flake (see #1345)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check the commit message here 755fda0
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd defer this to @ARR4N as he put up the fix.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cherry-picked these changes locally, and it didn't fix the flake.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| // Overriding the block number to n+1 is a common way for wallets to | ||
| // simulate transactions, however without the following fix, a contract | ||
| // can assert it is being simulated by checking if blockhash(n) == 0x0 and | ||
| // can behave differently during the simulation. (#32175 for more info) | ||
| // -- | ||
| // Modify the parent hash and number so that downstream, blockContext's | ||
| // GetHash function can correctly return n. | ||
| h.ParentHash = h.Hash() | ||
| h.Number.Add(h.Number, big.NewInt(1)) | ||
| } | ||
| blockContext := core.NewEVMBlockContext(h, api.chainContext(ctx), nil) | ||
|
|
||
| // Apply the customization rules if required. | ||
| if config != nil { | ||
| if config.BlockOverrides != nil && config.BlockOverrides.Number.ToInt().Uint64() == h.Number.Uint64()+1 { | ||
| // Overriding the block number to n+1 is a common way for wallets to | ||
| // simulate transactions, however without the following fix, a contract | ||
| // can assert it is being simulated by checking if blockhash(n) == 0x0 and | ||
| // can behave differently during the simulation. (#32175 for more info) | ||
| // -- | ||
| // Modify the parent hash and number so that downstream, blockContext's | ||
| // GetHash function can correctly return n. | ||
| h.ParentHash = h.Hash() | ||
| h.Number.Add(h.Number, big.NewInt(1)) | ||
| } | ||
| originalTime := block.Time() | ||
| config.BlockOverrides.Apply(&blockContext) | ||
| // Apply all relevant upgrades from [originalTime] to the block time set in the override. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.