-
Notifications
You must be signed in to change notification settings - Fork 201
Bump onflow/go-ethereum dependency to v1.15.9
#7241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 32 commits
06e4318
bd143ea
f4984b3
0051e2a
c9e8a7c
e6846a9
7118700
3e4f48e
46ae92d
a43e5ec
b2135ec
0a1b938
fbc8c10
024f2e1
34a46fc
4954acb
12c14c9
3da12b9
5490f42
dbf6009
53c44ce
05b8ee2
a69d18c
de0a491
0fbe41d
40cf351
5cc3dad
f171919
60b7938
09f0329
7e2a29e
d5fdbe3
2ba6b6a
3c90a8c
6afd9c0
1435ec5
ebd7db9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ import ( | |
| "github.com/onflow/atree" | ||
| "github.com/onflow/crypto/hash" | ||
| gethCommon "github.com/onflow/go-ethereum/common" | ||
| gethState "github.com/onflow/go-ethereum/core/state" | ||
| gethStateless "github.com/onflow/go-ethereum/core/stateless" | ||
| gethTracing "github.com/onflow/go-ethereum/core/tracing" | ||
| gethTypes "github.com/onflow/go-ethereum/core/types" | ||
|
|
@@ -102,21 +103,29 @@ func (db *StateDB) IsNewContract(addr gethCommon.Address) bool { | |
| return db.latestView().IsNewContract(addr) | ||
| } | ||
|
|
||
| // SelfDestruct flags the address for deletion. | ||
| // SelfDestruct flags the address for deletion and returns the previous balance. | ||
| // | ||
| // while this address exists for the rest of transaction, | ||
| // the balance of this account is return zero after the SelfDestruct call. | ||
| func (db *StateDB) SelfDestruct(addr gethCommon.Address) { | ||
| // While this address exists for the rest of the transaction, | ||
| // the balance of this account is cleared after the SelfDestruct call. | ||
| func (db *StateDB) SelfDestruct(addr gethCommon.Address) uint256.Int { | ||
| db.handleError(fmt.Errorf("legacy self destruct is not supported")) | ||
| return uint256.Int{} | ||
| } | ||
|
|
||
| // Selfdestruct6780 would only follow the self destruct steps if account is a new contract | ||
| // SelfDestruct6780 would only follow the self destruct steps if account is a new contract | ||
| // either just created, or address had balance before but got a contract deployed to it (in this tx). | ||
| func (db *StateDB) Selfdestruct6780(addr gethCommon.Address) { | ||
| // Returns the previous balance and a boolean value denoting whether the address was self destructed. | ||
| func (db *StateDB) SelfDestruct6780(addr gethCommon.Address) (uint256.Int, bool) { | ||
| balance, err := db.latestView().GetBalance(addr) | ||
| db.handleError(err) | ||
|
|
||
| if db.IsNewContract(addr) { | ||
| err := db.latestView().SelfDestruct(addr) | ||
| db.handleError(err) | ||
| return *balance, true | ||
| } | ||
|
|
||
| return *balance, false | ||
| } | ||
|
|
||
| // HasSelfDestructed returns true if address is flagged with self destruct. | ||
|
|
@@ -126,33 +135,45 @@ func (db *StateDB) HasSelfDestructed(addr gethCommon.Address) bool { | |
| } | ||
|
|
||
| // SubBalance substitutes the amount from the balance of the given address | ||
| // and returns the previous balance. | ||
| func (db *StateDB) SubBalance( | ||
| addr gethCommon.Address, | ||
| amount *uint256.Int, | ||
| reason gethTracing.BalanceChangeReason, | ||
| ) { | ||
| ) uint256.Int { | ||
| // negative amounts are not accepted. | ||
| if amount.Sign() < 0 { | ||
| db.handleError(types.ErrInvalidBalance) | ||
| return | ||
| return uint256.Int{} | ||
| } | ||
| err := db.latestView().SubBalance(addr, amount) | ||
| prevBalance, err := db.latestView().GetBalance(addr) | ||
| db.handleError(err) | ||
|
|
||
| err = db.latestView().SubBalance(addr, amount) | ||
| db.handleError(err) | ||
|
|
||
| return *prevBalance | ||
| } | ||
|
|
||
| // AddBalance adds the amount from the balance of the given address | ||
| // AddBalance adds the amount to the balance of the given address | ||
| // and returns the previous balance. | ||
| func (db *StateDB) AddBalance( | ||
| addr gethCommon.Address, | ||
| amount *uint256.Int, | ||
| reason gethTracing.BalanceChangeReason, | ||
| ) { | ||
| ) uint256.Int { | ||
| // negative amounts are not accepted. | ||
| if amount.Sign() < 0 { | ||
| db.handleError(types.ErrInvalidBalance) | ||
| return | ||
| return uint256.Int{} | ||
| } | ||
| err := db.latestView().AddBalance(addr, amount) | ||
| prevBalance, err := db.latestView().GetBalance(addr) | ||
| db.handleError(err) | ||
|
|
||
| err = db.latestView().AddBalance(addr, amount) | ||
| db.handleError(err) | ||
|
|
||
| return *prevBalance | ||
| } | ||
|
|
||
| // GetBalance returns the balance of the given address | ||
|
|
@@ -170,7 +191,11 @@ func (db *StateDB) GetNonce(addr gethCommon.Address) uint64 { | |
| } | ||
|
|
||
| // SetNonce sets the nonce value for the given address | ||
| func (db *StateDB) SetNonce(addr gethCommon.Address, nonce uint64) { | ||
| func (db *StateDB) SetNonce( | ||
| addr gethCommon.Address, | ||
| nonce uint64, | ||
| reason gethTracing.NonceChangeReason, | ||
|
Collaborator
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. For some reason, the Geth folks introduced this |
||
| ) { | ||
| err := db.latestView().SetNonce(addr, nonce) | ||
| db.handleError(err) | ||
| } | ||
|
|
@@ -196,10 +221,14 @@ func (db *StateDB) GetCodeSize(addr gethCommon.Address) int { | |
| return codeSize | ||
| } | ||
|
|
||
| // SetCode sets the code for the given address | ||
| func (db *StateDB) SetCode(addr gethCommon.Address, code []byte) { | ||
| // SetCode sets the code for the given address, and returns the | ||
| // previous code located at the given address, if any. | ||
| func (db *StateDB) SetCode(addr gethCommon.Address, code []byte) (prev []byte) { | ||
| prev = db.GetCode(addr) | ||
| err := db.latestView().SetCode(addr, code) | ||
| db.handleError(err) | ||
|
|
||
| return prev | ||
| } | ||
|
|
||
| // AddRefund adds the amount to the total (gas) refund | ||
|
|
@@ -254,10 +283,17 @@ func (db *StateDB) GetStorageRoot(addr gethCommon.Address) gethCommon.Hash { | |
| return root | ||
| } | ||
|
|
||
| // SetState sets a value for the given storage slot | ||
| func (db *StateDB) SetState(addr gethCommon.Address, key gethCommon.Hash, value gethCommon.Hash) { | ||
| err := db.latestView().SetState(types.SlotAddress{Address: addr, Key: key}, value) | ||
| // SetState sets a value for the given storage slot. | ||
| // It returns the previous value in any case. | ||
| func (db *StateDB) SetState( | ||
| addr gethCommon.Address, | ||
| key gethCommon.Hash, | ||
| value gethCommon.Hash, | ||
| ) gethCommon.Hash { | ||
| prevState, err := db.latestView().SetState(types.SlotAddress{Address: addr, Key: key}, value) | ||
| db.handleError(err) | ||
|
|
||
| return prevState | ||
| } | ||
|
|
||
| // GetTransientState returns the value for the given key of the transient storage | ||
|
|
@@ -481,6 +517,8 @@ func (db *StateDB) Commit(finalize bool) (hash.Hash, error) { | |
| return updateCommit, nil | ||
| } | ||
|
|
||
| func (db *StateDB) Finalise(deleteEmptyObjects bool) {} | ||
|
Collaborator
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. This is a no-op in our case, because our custom implementation of |
||
|
|
||
| // Finalize flushes all the changes | ||
| // to the permanent storage | ||
| func (db *StateDB) Finalize() error { | ||
|
|
@@ -542,6 +580,10 @@ func (s *StateDB) Witness() *gethStateless.Witness { | |
| return nil | ||
| } | ||
|
|
||
| func (s *StateDB) AccessEvents() *gethState.AccessEvents { | ||
| return &gethState.AccessEvents{} | ||
| } | ||
|
|
||
| func (db *StateDB) latestView() *DeltaView { | ||
| return db.views[len(db.views)-1] | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the deployment of COAs, we pass
nilfor thejumpDestsargument, as it is not exposed through theEVMobject. See also: