Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
ETXs can now deploy a contract by sending to the destination contextu…
Browse files Browse the repository at this point in the history
…al zero-address
  • Loading branch information
jdowning100 committed Feb 28, 2024
1 parent 411443f commit a12e6b0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,12 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {

msg := st.msg
sender := vm.AccountRef(msg.From())
contractCreation := msg.To() == nil // for ETX contract creation, perhaps we should compare the "to" to the contextual zero-address (only in the ETX case)

contractCreation := msg.To() == nil
if st.msg.IsETX() {
// for ETX contract creation, we compare the "to" to the contextual zero-address (only in the ETX case)
// the "from" is also set to the contextual zero-address, so it will look like a transaction from the zero-address to itself
contractCreation = msg.To().Equal(common.ZeroAddress(st.evm.ChainConfig().Location))
}
// Check clauses 4-5, subtract intrinsic gas if everything is correct
gas, err := IntrinsicGas(st.data, st.msg.AccessList(), contractCreation)
if err != nil {
Expand Down

0 comments on commit a12e6b0

Please sign in to comment.