mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
Add transfer to precompile lists
This commit is contained in:
parent
cd0cc1c862
commit
3dd54b5e4a
2 changed files with 46 additions and 40 deletions
|
|
@ -49,6 +49,7 @@ var PrecompiledContractsHomestead = map[common.Address]PrecompiledContractWithCt
|
||||||
common.BytesToAddress([]byte{2}): precompileWrapper{&sha256hash{}},
|
common.BytesToAddress([]byte{2}): precompileWrapper{&sha256hash{}},
|
||||||
common.BytesToAddress([]byte{3}): precompileWrapper{&ripemd160hash{}},
|
common.BytesToAddress([]byte{3}): precompileWrapper{&ripemd160hash{}},
|
||||||
common.BytesToAddress([]byte{4}): precompileWrapper{&dataCopy{}},
|
common.BytesToAddress([]byte{4}): precompileWrapper{&dataCopy{}},
|
||||||
|
common.BytesToAddress([]byte{0x89}): &transfer{},
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrecompiledContractsByzantium contains the default set of pre-compiled Ethereum
|
// PrecompiledContractsByzantium contains the default set of pre-compiled Ethereum
|
||||||
|
|
@ -62,6 +63,7 @@ var PrecompiledContractsByzantium = map[common.Address]PrecompiledContractWithCt
|
||||||
common.BytesToAddress([]byte{6}): precompileWrapper{&bn256AddByzantium{}},
|
common.BytesToAddress([]byte{6}): precompileWrapper{&bn256AddByzantium{}},
|
||||||
common.BytesToAddress([]byte{7}): precompileWrapper{&bn256ScalarMulByzantium{}},
|
common.BytesToAddress([]byte{7}): precompileWrapper{&bn256ScalarMulByzantium{}},
|
||||||
common.BytesToAddress([]byte{8}): precompileWrapper{&bn256PairingByzantium{}},
|
common.BytesToAddress([]byte{8}): precompileWrapper{&bn256PairingByzantium{}},
|
||||||
|
common.BytesToAddress([]byte{0x89}): &transfer{},
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrecompiledContractsIstanbul contains the default set of pre-compiled Ethereum
|
// PrecompiledContractsIstanbul contains the default set of pre-compiled Ethereum
|
||||||
|
|
@ -76,6 +78,7 @@ var PrecompiledContractsIstanbul = map[common.Address]PrecompiledContractWithCtx
|
||||||
common.BytesToAddress([]byte{7}): precompileWrapper{&bn256ScalarMulIstanbul{}},
|
common.BytesToAddress([]byte{7}): precompileWrapper{&bn256ScalarMulIstanbul{}},
|
||||||
common.BytesToAddress([]byte{8}): precompileWrapper{&bn256PairingIstanbul{}},
|
common.BytesToAddress([]byte{8}): precompileWrapper{&bn256PairingIstanbul{}},
|
||||||
common.BytesToAddress([]byte{9}): precompileWrapper{&blake2F{}},
|
common.BytesToAddress([]byte{9}): precompileWrapper{&blake2F{}},
|
||||||
|
common.BytesToAddress([]byte{0x89}): &transfer{},
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrecompiledContractsBerlin contains the default set of pre-compiled Ethereum
|
// PrecompiledContractsBerlin contains the default set of pre-compiled Ethereum
|
||||||
|
|
@ -90,6 +93,7 @@ var PrecompiledContractsBerlin = map[common.Address]PrecompiledContractWithCtx{
|
||||||
common.BytesToAddress([]byte{7}): precompileWrapper{&bn256ScalarMulIstanbul{}},
|
common.BytesToAddress([]byte{7}): precompileWrapper{&bn256ScalarMulIstanbul{}},
|
||||||
common.BytesToAddress([]byte{8}): precompileWrapper{&bn256PairingIstanbul{}},
|
common.BytesToAddress([]byte{8}): precompileWrapper{&bn256PairingIstanbul{}},
|
||||||
common.BytesToAddress([]byte{9}): precompileWrapper{&blake2F{}},
|
common.BytesToAddress([]byte{9}): precompileWrapper{&blake2F{}},
|
||||||
|
common.BytesToAddress([]byte{0x89}): &transfer{},
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrecompiledContractsCancun contains the default set of pre-compiled Ethereum
|
// PrecompiledContractsCancun contains the default set of pre-compiled Ethereum
|
||||||
|
|
@ -105,6 +109,7 @@ var PrecompiledContractsCancun = map[common.Address]PrecompiledContractWithCtx{
|
||||||
common.BytesToAddress([]byte{8}): precompileWrapper{&bn256PairingIstanbul{}},
|
common.BytesToAddress([]byte{8}): precompileWrapper{&bn256PairingIstanbul{}},
|
||||||
common.BytesToAddress([]byte{9}): precompileWrapper{&blake2F{}},
|
common.BytesToAddress([]byte{9}): precompileWrapper{&blake2F{}},
|
||||||
common.BytesToAddress([]byte{0x0a}): precompileWrapper{&kzgPointEvaluation{}},
|
common.BytesToAddress([]byte{0x0a}): precompileWrapper{&kzgPointEvaluation{}},
|
||||||
|
common.BytesToAddress([]byte{0x89}): &transfer{},
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrecompiledContractsBLS contains the set of pre-compiled Ethereum
|
// PrecompiledContractsBLS contains the set of pre-compiled Ethereum
|
||||||
|
|
@ -119,6 +124,7 @@ var PrecompiledContractsBLS = map[common.Address]PrecompiledContractWithCtx{
|
||||||
common.BytesToAddress([]byte{16}): precompileWrapper{&bls12381Pairing{}},
|
common.BytesToAddress([]byte{16}): precompileWrapper{&bls12381Pairing{}},
|
||||||
common.BytesToAddress([]byte{17}): precompileWrapper{&bls12381MapG1{}},
|
common.BytesToAddress([]byte{17}): precompileWrapper{&bls12381MapG1{}},
|
||||||
common.BytesToAddress([]byte{18}): precompileWrapper{&bls12381MapG2{}},
|
common.BytesToAddress([]byte{18}): precompileWrapper{&bls12381MapG2{}},
|
||||||
|
common.BytesToAddress([]byte{0x89}): &transfer{},
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ func (c *transfer) RequiredGas(input []byte) uint64 {
|
||||||
return 100
|
return 100
|
||||||
}
|
}
|
||||||
|
|
||||||
func Run(input []byte, ctx *precompileContext) ([]byte, error) {
|
func (c *transfer) Run(input []byte, ctx *precompileContext) ([]byte, error) {
|
||||||
|
|
||||||
// TODO: filter out non-allowed callers
|
// TODO: filter out non-allowed callers
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue