You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: public/content/developers/tutorials/short-abi/index.md
-27Lines changed: 0 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,6 @@ The vast majority of transactions access a contract from an externally-owned acc
51
51
Most contracts are written in Solidity and interpret their data field per [the application binary interface (ABI)](https://docs.soliditylang.org/en/latest/abi-spec.html#formal-specification-of-the-encoding).
52
52
53
53
However, the ABI was designed for L1, where a byte of calldata costs approximately the same as four arithmetic operations, not L2 where a byte of calldata costs more than a thousand arithmetic operations.
54
-
For example, [here is an ERC-20 transfer transaction](https://kovan-optimistic.etherscan.io/tx/0x7ce4c144ebfce157b4de99d8ad53a352ae91b57b3fa06d8a1c79439df6bfa998).
55
54
The calldata is divided like this:
56
55
57
56
| Section | Length | Bytes | Wasted bytes | Wasted gas | Necessary bytes | Necessary gas |
@@ -98,8 +97,6 @@ It would make a production ERC-20 contract useless, but it makes life easier whe
98
97
} // function faucet
99
98
```
100
99
101
-
[You can see an example of this contract being deployed here](https://kovan-optimistic.etherscan.io/address/0x950c753c0edbde44a74d3793db738a318e9c8ce8).
[This is the contract that transactions are supposed to call with shorter calldata](https://github.com/qbzzt/ethereum.org-20220330-shortABI/blob/master/contracts/CalldataInterpreter.sol).
@@ -368,17 +365,6 @@ Create a transfer transaction. The first byte is "0x02", followed by the destina
368
365
}) // describe
369
366
```
370
367
371
-
### Example {#example}
372
-
373
-
If you want to see these files in action without running them yourself, follow these links:
374
-
375
-
1.[Deployment of `OrisUselessToken`](https://kovan-optimistic.etherscan.io/tx/1410744) to [address `0x950c753c0edbde44a74d3793db738a318e9c8ce8`](https://kovan-optimistic.etherscan.io/address/0x950c753c0edbde44a74d3793db738a318e9c8ce8).
376
-
2.[Deployment of `CalldataInterpreter`](https://kovan-optimistic.etherscan.io/tx/1410745) to [address `0x16617fea670aefe3b9051096c0eb4aeb4b3a5f55`](https://kovan-optimistic.etherscan.io/address/0x16617fea670aefe3b9051096c0eb4aeb4b3a5f55).
377
-
3.[Call to `faucet()`](https://kovan-optimistic.etherscan.io/tx/1410746).
378
-
4.[Call to `OrisUselessToken.approve()`](https://kovan-optimistic.etherscan.io/tx/1410747).
379
-
This call has to go directly to the token contract because the processing relies on `msg.sender`.
380
-
5.[Call to `transfer()`](https://kovan-optimistic.etherscan.io/tx/1410748).
381
-
382
368
## Reducing the cost when you do control the destination contract {#reducing-the-cost-when-you-do-control-the-destination-contract}
383
369
384
370
If you do have control over the destination contract you can create functions that bypass the `msg.sender` checks because they trust the calldata interpreter.
Note that `transferFromTx` requires two address parameters: the giver of the allowance and the receiver.
590
576
591
-
### Example {#example-2}
592
-
593
-
If you want to see these files in action without running them yourself, follow these links:
594
-
595
-
1.[Deployment of `OrisUselessToken-2`](https://kovan-optimistic.etherscan.io/tx/1475397) at address [`0xb47c1f550d8af70b339970c673bbdb2594011696`](https://kovan-optimistic.etherscan.io/address/0xb47c1f550d8af70b339970c673bbdb2594011696).
596
-
2.[Deployment of `CalldataInterpreter`](https://kovan-optimistic.etherscan.io/tx/1475400) at address [`0x0dccfd03e3aaba2f8c4ea4008487fd0380815892`](https://kovan-optimistic.etherscan.io/address/0x0dccfd03e3aaba2f8c4ea4008487fd0380815892).
597
-
3.[Call to `setProxy()`](https://kovan-optimistic.etherscan.io/tx/1475402).
598
-
4.[Call to `faucet()`](https://kovan-optimistic.etherscan.io/tx/1475409).
599
-
5.[Call to `transferProxy()`](https://kovan-optimistic.etherscan.io/tx/1475416).
600
-
6.[Call to `approveProxy()`](https://kovan-optimistic.etherscan.io/tx/1475419).
601
-
7.[Call to `transferFromProxy()`](https://kovan-optimistic.etherscan.io/tx/1475421).
602
-
Note that this call comes from a different address than the other ones, `poorSigner` instead of `signer`.
603
-
604
577
## Conclusion {#conclusion}
605
578
606
579
Both [Optimism](https://medium.com/ethereum-optimism/the-road-to-sub-dollar-transactions-part-2-compression-edition-6bb2890e3e92) and [Arbitrum](https://developer.offchainlabs.com/docs/special_features) are looking for ways to reduce the size of the calldata written to L1 and therefore the cost of transactions.
0 commit comments