Skip to content

Commit

Permalink
cannon: rename Oracle.sol to PreimageOracle.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
protolambda committed Jun 19, 2023
1 parent fc1001f commit 1749fe1
Show file tree
Hide file tree
Showing 13 changed files with 155 additions and 155 deletions.
2 changes: 1 addition & 1 deletion cannon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ go build -o cannon .

The Cannon contracts:
- `MIPS.sol`: A MIPS emulator implementation, to run a single instruction onchain, with merkleized VM memory.
- `Oracle.sol`: implements the pre-image oracle ABI, to support the instruction execution pre-image requests.
- `PreimageOracle.sol`: implements the pre-image oracle ABI, to support the instruction execution pre-image requests.

The smart-contracts are integrated into the Optimism monorepo contracts:
[`../packages/contracts-bedrock/contracts/cannon`](../packages/contracts-bedrock/contracts/cannon)
Expand Down
2 changes: 1 addition & 1 deletion cannon/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ This ABI is implemented by the VM by intercepting the `read`/`write` syscalls to
- `preimage client read = 5`: used by the client to read pre-image data, starting from the latest pre-image reading offset.
- `preimage client write = 6`: used by the client to change the pre-image key. The key may change a little bit at a time. The last 32 written bytes count as key for retrieval when reading the pre-image. Changing the key also resets the read offset to 0.

The data is loaded into `Oracle.sol` using the respective loading function based on the pre-image type.
The data is loaded into `PreimageOracle.sol` using the respective loading function based on the pre-image type.
And then retrieved during execution of the `read` syscall.

Note that although the oracle provides up to 32 bytes of the pre-image,
Expand Down
2 changes: 1 addition & 1 deletion cannon/mipsevm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ To run:
5. Instrument the emulator with the state, and pre-image oracle, using `NewInstrumentedState`
6. Step through the instrumented state with `Step(proof)`,
where `proof==true` if witness data should be generated. Steps are faster with `proof==false`.
7. Optionally repeat the step on-chain by calling `MIPS.sol` and `Oracle.sol`, using the above witness data.
7. Optionally repeat the step on-chain by calling `MIPS.sol` and `PreimageOracle.sol`, using the above witness data.
4 changes: 2 additions & 2 deletions cannon/mipsevm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func LoadContracts() (*Contracts, error) {
var mips, oracle Contract
mips.DeployedBytecode.Object = hexutil.MustDecode(bindings.MIPSDeployedBin)
mips.DeployedBytecode.SourceMap = bindings.MIPSDeployedSourceMap
oracle.DeployedBytecode.Object = hexutil.MustDecode(bindings.OracleDeployedBin)
oracle.DeployedBytecode.SourceMap = bindings.OracleDeployedSourceMap
oracle.DeployedBytecode.Object = hexutil.MustDecode(bindings.PreimageOracleDeployedBin)
oracle.DeployedBytecode.SourceMap = bindings.PreimageOracleDeployedSourceMap
return &Contracts{
MIPS: &mips,
Oracle: &oracle,
Expand Down
2 changes: 1 addition & 1 deletion cannon/mipsevm/evm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func testContractsSetup(t *testing.T) (*Contracts, *Addresses) {
func SourceMapTracer(t *testing.T, contracts *Contracts, addrs *Addresses) vm.EVMLogger {
mipsSrcMap, err := contracts.MIPS.SourceMap([]string{"../../packages/contracts-bedrock/contracts/cannon/MIPS.sol"})
require.NoError(t, err)
oracleSrcMap, err := contracts.Oracle.SourceMap([]string{"../../packages/contracts-bedrock/contracts/cannon/Oracle.sol"})
oracleSrcMap, err := contracts.Oracle.SourceMap([]string{"../../packages/contracts-bedrock/contracts/cannon/PreimageOracle.sol"})
require.NoError(t, err)

return srcmap.NewSourceMapTracer(map[common.Address]*srcmap.SourceMap{addrs.MIPS: mipsSrcMap, addrs.Oracle: oracleSrcMap}, os.Stdout)
Expand Down
10 changes: 5 additions & 5 deletions op-bindings/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ bindings: l1block-bindings \
standard-bridge-bindings \
cross-domain-messenger-bindings \
cannon-mips \
cannon-oracle
cannon-preimage-oracle

version:
forge --version
Expand Down Expand Up @@ -139,17 +139,17 @@ cross-domain-messenger-bindings: compile
cannon-mips: compile
./gen_bindings.sh contracts/cannon/MIPS.sol:MIPS $(pkg)

cannon-oracle: compile
./gen_bindings.sh contracts/cannon/Oracle.sol:Oracle $(pkg)
cannon-preimage-oracle: compile
./gen_bindings.sh contracts/cannon/PreimageOracle.sol:PreimageOracle $(pkg)


more:
go run ./gen/main.go \
-artifacts ../packages/contracts-bedrock/artifacts \
-forge-artifacts ../packages/contracts-bedrock/forge-artifacts \
-out ./bindings \
-contracts SystemConfig,OptimismMintableERC20Factory,L2StandardBridge,L1BlockNumber,LegacyMessagePasser,DeployerWhitelist,Proxy,OptimismPortal,L2ToL1MessagePasser,L2CrossDomainMessenger,SequencerFeeVault,L1Block,LegacyERC20ETH,WETH9,GovernanceToken,L1CrossDomainMessenger,L2ERC721Bridge,OptimismMintableERC721Factory,ProxyAdmin,MIPS,Oracle \
-source-maps MIPS,Oracle \
-contracts SystemConfig,OptimismMintableERC20Factory,L2StandardBridge,L1BlockNumber,LegacyMessagePasser,DeployerWhitelist,Proxy,OptimismPortal,L2ToL1MessagePasser,L2CrossDomainMessenger,SequencerFeeVault,L1Block,LegacyERC20ETH,WETH9,GovernanceToken,L1CrossDomainMessenger,L2ERC721Bridge,OptimismMintableERC721Factory,ProxyAdmin,MIPS,PreimageOracle \
-source-maps MIPS,PreimageOracle \
-package bindings

mkdir:
Expand Down
2 changes: 1 addition & 1 deletion op-bindings/bindings/mips.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1749fe1

Please sign in to comment.