@@ -61,14 +61,29 @@ type StateReader interface {
61
61
// AddressContext carries addresses available to contexts such as calls and
62
62
// contract creation.
63
63
//
64
- // With respect to contract creation, the Self address MAY be the predicted
65
- // address of the contract about to be deployed, which may not exist yet.
64
+ // With respect to contract creation, the EVMSemantic.Self address MAY be the
65
+ // predicted address of the contract about to be deployed, which might not exist
66
+ // yet.
66
67
type AddressContext struct {
67
- Origin common.Address // always equivalent to vm.ORIGIN op code
68
+ Origin common.Address // equivalent to vm.ORIGIN op code
69
+ // EVMSemantic addresses are those defined by the rules of the EVM, based on
70
+ // the type of call made to a contract; i.e. the addresses pushed to the
71
+ // stack by the vm.CALLER and vm.SELF op codes, respectively.
68
72
EVMSemantic CallerAndSelf
69
- Raw * CallerAndSelf
73
+ // Raw addresses are those that would be available to a contract under a
74
+ // standard CALL; i.e. not interpreted according EVM rules. They are the
75
+ // "intuitive" addresses such that the `Caller` is the account that called
76
+ // `Self` even if it did so via DELEGATECALL or CALLCODE (in which cases
77
+ // `Raw` and `EVMSemantic` would differ).
78
+ //
79
+ // Raw MUST NOT be nil when returned to a precompile implementation but MAY
80
+ // be nil in other situations (e.g. hooks), which MUST document behaviour on
81
+ // a case-by-case basis.
82
+ Raw * CallerAndSelf
70
83
}
71
84
85
+ // CallerAndSelf carries said addresses for use in an [AddressContext], where
86
+ // the definitions of `Caller` and `Self` are defined based on context.
72
87
type CallerAndSelf struct {
73
88
Caller common.Address
74
89
Self common.Address
0 commit comments