Skip to content

Commit

Permalink
Integrate precompile logic (#94)
Browse files Browse the repository at this point in the history
* Codegen the contract list

* Add

* Add warning

* Fix test
  • Loading branch information
ferranbt authored Nov 7, 2023
1 parent bd909ab commit c3ca8ff
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 558 deletions.
31 changes: 1 addition & 30 deletions core/vm/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,31 +83,6 @@ var PrecompiledContractsIstanbul = map[common.Address]PrecompiledContract{
common.BytesToAddress([]byte{9}): &blake2F{},
}

// PrecompiledContractsSuave contains the default set of pre-compiled SUAVE VM
// contracts used in the suave testnet. It's a superset of Berlin precompiles.
// Confidential contracts (implementing SuavePrecompiledContract)
// are ran with their respective RunConfidential in confidential setting
var PrecompiledContractsSuave = map[common.Address]SuavePrecompiledContract{
isConfidentialAddress: &isConfidentialPrecompile{},
confidentialInputsAddress: &confidentialInputsPrecompile{},

confStoreAddress: newconfStore(),
confRetrieveAddress: newconfRetrieve(),

newBidAddress: newNewBid(),
fetchBidsAddress: newFetchBids(),
extractHintAddress: &extractHint{},

signEthTransactionAddress: &signEthTransaction{},
simulateBundleAddress: &simulateBundle{},
buildEthBlockAddress: &buildEthBlock{},
submitEthBlockBidToRelayAddress: &submitEthBlockBidToRelay{},
submitBundleJsonRPCAddress: &submitBundleJsonRPC{},
fillMevShareBundleAddress: &fillMevShareBundle{},

ethcallAddr: &ethCallPrecompile{},
}

// PrecompiledContractsBerlin contains the default set of pre-compiled Ethereum
// contracts used in the Berlin release.
var PrecompiledContractsBerlin = map[common.Address]PrecompiledContract{
Expand Down Expand Up @@ -137,7 +112,6 @@ var PrecompiledContractsBLS = map[common.Address]PrecompiledContract{
}

var (
PrecompiledAddressesSuave []common.Address
PrecompiledAddressesBerlin []common.Address
PrecompiledAddressesIstanbul []common.Address
PrecompiledAddressesByzantium []common.Address
Expand All @@ -157,9 +131,6 @@ func init() {
for k := range PrecompiledContractsBerlin {
PrecompiledAddressesBerlin = append(PrecompiledAddressesBerlin, k)
}
for k := range PrecompiledContractsSuave {
PrecompiledAddressesSuave = append(PrecompiledAddressesSuave, k)
}
}

// ActivePrecompiles returns the precompiles enabled with the current configuration.
Expand All @@ -178,7 +149,7 @@ func ActivePrecompiles(rules params.Rules) []common.Address {
}

if rules.IsSuave {
return append(basePrecompiles, PrecompiledAddressesSuave...)
return append(basePrecompiles, addrList...)
}

return basePrecompiles
Expand Down
Loading

0 comments on commit c3ca8ff

Please sign in to comment.