Skip to content
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

Add remote contracts #114

Merged
merged 7 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,17 @@ jobs:
command: make && git diff --exit-code
working_directory: boba-bindings

boba-bindgen-remote:
docker:
- image: <<pipeline.parameters.ci_builder_image>>
resource_class: xlarge
steps:
- checkout
- run:
name: bindgen remote bindings
command: make bindgen-remote && git diff --exit-code
working_directory: boba-bindings

js-lint-test:
parameters:
package_name:
Expand Down Expand Up @@ -1613,6 +1624,7 @@ workflows:
- pnpm-monorepo
- op-bindings-build
- boba-bindings-build
- boba-bindgen-remote
- js-lint-test:
name: chain-mon-tests
coverage_flag: chain-mon-tests
Expand Down
52 changes: 44 additions & 8 deletions boba-bindings/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,50 @@ compile:

bindings: compile bindings-build

bindings-build:
go run ./gen/main.go \
-forge-artifacts $(contracts-dir)/forge-artifacts \
-out ./bindings \
-contracts ./artifacts.json \
-source-maps MIPS,PreimageOracle \
-package $(pkg) \
-monorepo-base $(monorepo-base)
bindings-build: bindgen-generate-local

bindgen: compile bindgen-generate-all

bindgen-generate-all:
go run ./cmd/ \
generate \
--monorepo-base $(monorepo-base) \
--metadata-out ./$(pkg) \
--bindings-package $(pkg) \
--contracts-list ./artifacts.json \
all \
--forge-artifacts $(contracts-dir)/forge-artifacts \
--source-maps-list MIPS,PreimageOracle \
--etherscan.apikey.eth $(ETHERSCAN_APIKEY_ETH) \
--etherscan.apikey.op $(ETHERSCAN_APIKEY_OP) \
--rpc.url.eth $(RPC_URL_ETH) \
--rpc.url.op $(RPC_URL_OP)

bindgen-local: compile bindgen-generate-local

bindgen-generate-local:
go run ./cmd/ \
generate \
--monorepo-base $(monorepo-base) \
--metadata-out ./$(pkg) \
--bindings-package $(pkg) \
--contracts-list ./artifacts.json \
local \
--forge-artifacts $(contracts-dir)/forge-artifacts \
--source-maps-list MIPS,PreimageOracle

bindgen-remote:
go run ./cmd/ \
generate \
--monorepo-base $(monorepo-base) \
--metadata-out ./$(pkg) \
--bindings-package $(pkg) \
--contracts-list ./artifacts.json \
remote \
--etherscan.apikey.eth $(ETHERSCAN_APIKEY_ETH) \
--etherscan.apikey.op $(ETHERSCAN_APIKEY_OP) \
--rpc.url.eth $(RPC_URL_ETH) \
--rpc.url.op $(RPC_URL_OP)

mkdir:
mkdir -p $(pkg)
Expand Down
103 changes: 62 additions & 41 deletions boba-bindings/artifacts.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,62 @@
[
"SystemConfig",
"L1CrossDomainMessenger",
"L1StandardBridge",
"OptimismPortal",
"L2OutputOracle",
"AddressManager",
"L1Block",
"L2ToL1MessagePasser",
"GasPriceOracle",
"L2CrossDomainMessenger",
"L2StandardBridge",
"L2ERC721Bridge",
"L1ERC721Bridge",
"OptimismMintableERC721Factory",
"SequencerFeeVault",
"BaseFeeVault",
"L1FeeVault",
"OptimismMintableERC20Factory",
"OptimismMintableERC20",
"LegacyERC20ETH",
"Proxy",
"ProxyAdmin",
"LegacyMessagePasser",
"ERC20",
"WETH9",
"DeployerWhitelist",
"L1BlockNumber",
"DisputeGameFactory",
"FaultDisputeGame",
"AlphabetVM",
"StandardBridge",
"CrossDomainMessenger",
"MIPS",
"PreimageOracle",
"EAS",
"SchemaRegistry",
"BOBA",
"GovernanceToken",
"L2GovernanceERC20"
]
{
"local": [
"SystemConfig",
"L1CrossDomainMessenger",
"L1StandardBridge",
"OptimismPortal",
"L2OutputOracle",
"AddressManager",
"L1Block",
"L2ToL1MessagePasser",
"GasPriceOracle",
"L2CrossDomainMessenger",
"L2StandardBridge",
"L2ERC721Bridge",
"L1ERC721Bridge",
"OptimismMintableERC721Factory",
"SequencerFeeVault",
"BaseFeeVault",
"L1FeeVault",
"OptimismMintableERC20Factory",
"OptimismMintableERC20",
"LegacyERC20ETH",
"Proxy",
"ProxyAdmin",
"LegacyMessagePasser",
"ERC20",
"WETH9",
"DeployerWhitelist",
"L1BlockNumber",
"DisputeGameFactory",
"FaultDisputeGame",
"AlphabetVM",
"StandardBridge",
"CrossDomainMessenger",
"MIPS",
"PreimageOracle",
"EAS",
"SchemaRegistry",
"BOBA",
"GovernanceToken",
"L2GovernanceERC20"
],
"remote": [
{
"name": "Create2Deployer",
"verified": true,
"deployments": {
"eth": "0xF49600926c7109BD66Ab97a2c036bf696e58Dbc2",
souradeep-das marked this conversation as resolved.
Show resolved Hide resolved
"op": "0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2"
}
},
{
"name": "DeterministicDeploymentProxy",
"verified": false,
"deployments": {
"eth": "0x4e59b44847b379578588920cA78FbF26c0B4956C",
"op": "0x4e59b44847b379578588920cA78FbF26c0B4956C"
},
"abi": "[{\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"fallback\",\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"creationCode\",\"type\":\"bytes\"}]}]"
}
]
}
10 changes: 10 additions & 0 deletions boba-bindings/bindgen/fixtures_bytecode_test.go

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions boba-bindings/bindgen/fixtures_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package bindgen

// The Init bytecode used for these tests can either be sourced
// on-chain using the deployment tx of these contracts, or can be
// found in the bindings output from BindGen (../bindings/)
var removeDeploymentSaltTests = []struct {
name string
deploymentData string
deploymentSalt string
expected string
}{
{
"Case #1",
Safe_v130InitBytecode,
"0000000000000000000000000000000000000000000000000000000000000000",
Safe_v130InitBytecodeNoSalt,
},
{
"Case #2",
Permit2InitBytecode,
"0000000000000000000000000000000000000000d3af2663da51c10215000000",
Permit2InitBytecodeNoSalt,
},
{
"Case #3",
EntryPointInitBytecode,
"0000000000000000000000000000000000000000000000000000000000000000",
EntryPointInitBytecodeNoSalt,
},
}

var removeDeploymentSaltTestsFailures = []struct {
name string
deploymentData string
deploymentSalt string
expectedError string
}{
{
"Failure Case #1 Invalid Regex",
"0x1234abc",
"[invalid-regex",
"failed to compile regular expression: error parsing regexp: missing closing ]: `[invalid-regex)`",
},
{
"Failure Case #2 Salt Not Found",
"0x1234abc",
"4567",
"expected salt: 4567 to be at the beginning of the contract initialization code: 0x1234abc, but it wasn't",
},
}
Loading