Skip to content
This repository was archived by the owner on Nov 6, 2022. It is now read-only.

Precompile iface patch #686

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
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
9 changes: 5 additions & 4 deletions contracts/arbos/builtin/ArbAddressTable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ interface ArbAddressTable {
* @param addr address to register
* @return index of the address (existing index, or newly created index if not already registered)
*/
function register(address addr) external returns(uint);
function register(address addr) external returns(uint index);

/**
* @param addr address to lookup
* @return index of an address in the address table (revert if address isn't in the table)
*/
function lookup(address addr) external view returns(uint);
function lookup(address addr) external view returns(uint index);

/**
* @notice Check whether an address exists in the address table
Expand All @@ -39,9 +39,10 @@ interface ArbAddressTable {
* @notice read a compressed address from a bytes buffer
* @param buf bytes buffer containing an address
* @param offset offset of target address
* @return resulting address and updated offset into the buffer (revert if buffer is too short)
* @return addr resulting address
* @return newOffset updated offset into the buffer (revert if buffer is too short)
*/
function decompress(bytes calldata buf, uint offset) external pure returns(address, uint);
function decompress(bytes calldata buf, uint offset) external pure returns(address addr, uint newOffset);

/**
* @notice compress an address and return the result, possibly modifying the compression/decompression state
Expand Down
2 changes: 1 addition & 1 deletion contracts/arbos/builtin/ArbAggregator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interface ArbAggregator {
// Get the preferred aggregator for an address.
// Returns (preferredAggregatorAddress, isDefault)
// isDefault is true if addr is set to prefer the default aggregator
function getPreferredAggregator(address addr) external view returns (address, bool);
function getPreferredAggregator(address addr) external view returns (address preferredAggregatorAddress, bool isDefault);

// Set the caller's preferred aggregator.
// If prefAgg is zero, this sets the caller to prefer the default aggregator
Expand Down
2 changes: 1 addition & 1 deletion contracts/arbos/builtin/ArbBLS.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ interface ArbBLS {
function register(uint x0, uint x1, uint y0, uint y1) external;

// Get the BLS public key associated with an address (revert if there isn't one)
function getPublicKey(address addr) external view returns (uint, uint, uint, uint);
function getPublicKey(address addr) external view returns (uint x0, uint x1, uint y0, uint y1);
}

2 changes: 1 addition & 1 deletion contracts/arbos/builtin/ArbFunctionTable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ interface ArbFunctionTable {

// Get the entry from addr's function table, at index; revert if addr has no table or index out of bounds
// Returns (functionCode, isPayable, gasLimit)
function get(address addr, uint index) external view returns(uint, bool, uint);
function get(address addr, uint index) external view returns(uint functionCode, bool isPayable, uint gasLimit);
}

30 changes: 23 additions & 7 deletions contracts/arbos/builtin/ArbGasInfo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,46 @@ interface ArbGasInfo {
// per ArbGas congestion,
// per ArbGas total
// )
function getPricesInWeiWithAggregator(address aggregator) external view returns (uint, uint, uint, uint, uint, uint);
function getPricesInWeiWithAggregator(address aggregator) external view returns (uint perTx,
uint perCalldataUnit,
uint perStorageAlloc,
uint perArbGasBase,
uint perArbGasCongestion,
uint perArbGasTotal);

// return gas prices in wei, as described above, assuming the caller's preferred aggregator is used
// if the caller hasn't specified a preferred aggregator, the default aggregator is assumed
function getPricesInWei() external view returns (uint, uint, uint, uint, uint, uint);
function getPricesInWei() external view returns (uint perTx,
uint perCalldataUnit,
uint perStorageAlloc,
uint perArbGasBase,
uint perArbGasCongestion,
uint perArbGasTotal);

// return prices in ArbGas (per L2 tx, per L1 calldata unit, per storage allocation),
// assuming the specified aggregator is used
function getPricesInArbGasWithAggregator(address aggregator) external view returns (uint, uint, uint);
function getPricesInArbGasWithAggregator(address aggregator) external view returns (uint perL2Tx,
uint perCalldataUnit,
uint perStorageAlloc);

// return gas prices in ArbGas, as described above, assuming the caller's preferred aggregator is used
// if the caller hasn't specified a preferred aggregator, the default aggregator is assumed
function getPricesInArbGas() external view returns (uint, uint, uint);
function getPricesInArbGas() external view returns (uint perL2Tx,
uint perCalldataUnit,
uint perStorageAlloc);

// return gas accounting parameters (speedLimitPerSecond, gasPoolMax, maxTxGasLimit)
function getGasAccountingParams() external view returns (uint, uint, uint);
function getGasAccountingParams() external view returns (uint speedLimitPerSecond,
uint gasPoolMax,
uint maxTxGasLimit);

// get ArbOS's estimate of the L1 gas price in wei
function getL1GasPriceEstimate() external view returns(uint);
function getL1GasPriceEstimate() external view returns(uint priceInWei);

// set ArbOS's estimate of the L1 gas price in wei
// reverts unless called by chain owner or designated gas oracle (if any)
function setL1GasPriceEstimate(uint priceInWei) external;

// get L1 gas fees paid by the current transaction (txBaseFeeWei, calldataFeeWei)
// get L1 gas fees paid by the current transaction (i.e. txBaseFeeWei + calldataFeeWei)
function getCurrentTxL1GasFees() external view returns(uint);
}
34 changes: 25 additions & 9 deletions contracts/arbos/builtin/ArbRetryableTx.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,27 @@ interface ArbRetryableTx {
/**
* @notice Return the price, in wei, of submitting a new retryable tx with a given calldata size.
* @param calldataSize call data size to get price of (in wei)
* @return (price, nextUpdateTimestamp). Price is guaranteed not to change until nextUpdateTimestamp.
* @return price Price in wei
* @return nextUpdateTimestamp Price is guaranteed not to change until nextUpdateTimestamp
*/
function getSubmissionPrice(uint calldataSize) external view returns (uint, uint);
function getSubmissionPrice(uint calldataSize) external view returns (uint price, uint nextUpdateTimestamp);

/**
* @notice Return the price, in wei, of extending the lifetime of userTxHash by an additional lifetime period. Revert if userTxHash doesn't exist.
* @param userTxHash unique ticket identifier
* @return (price, nextUpdateTimestamp). Price is guaranteed not to change until nextUpdateTimestamp.
* @notice Return the price, in wei, of extending the lifetime of userTxHash by an additional lifetime period. Revert if userTxHash doesn't exist.
* @param userTxHash unique ticket identifier
* @return price Price in wei
* @return nextUpdateTimestamp Price is guaranteed not to change until nextUpdateTimestamp
*/
function getKeepalivePrice(bytes32 userTxHash) external view returns(uint, uint);
function getKeepalivePrice(bytes32 userTxHash) external view returns(uint price, uint nextUpdateTimestamp);

/**
@notice Deposits callvalue into the sender's L2 account, then adds one lifetime period to the life of userTxHash.
* @notice Deposits callvalue into the sender's L2 account, then adds one lifetime period to the life of userTxHash.
* If successful, emits LifetimeExtended event.
* Revert if userTxHash does not exist, or if the timeout of userTxHash is already at least one lifetime period in the future, or if the sender has insufficient funds (after the deposit).
* @param userTxHash unique ticket identifier
* @return New timeout of userTxHash.
* @return newTimeout New timeout of userTxHash.
*/
function keepalive(bytes32 userTxHash) external payable returns(uint);
function keepalive(bytes32 userTxHash) external payable returns(uint newTimeout);

/**
* @notice Return the beneficiary of userTxHash.
Expand All @@ -67,6 +69,20 @@ interface ArbRetryableTx {
*/
function cancel(bytes32 userTxHash) external;

/**
* @notice Cannot be called manually, included for tx decoding
*/
function createRetryableTicket(
address destAddr,
uint256 l2CallValue,
uint256 maxSubmissionCost,
address excessFeeRefundAddress,
address callValueRefundAddress,
uint256 maxGas,
uint256 gasPriceBid,
bytes calldata data
) external;

event TicketCreated(bytes32 indexed userTxHash);
event LifetimeExtended(bytes32 indexed userTxHash, uint newTimeout);
event Redeemed(bytes32 indexed userTxHash);
Expand Down
7 changes: 6 additions & 1 deletion contracts/arbos/builtin/ArbStatistics.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ interface ArbStatistics {
// Total ArbGas used
// Number of transaction receipt issued
// Number of contracts created
function getStats() external view returns(uint, uint, uint, uint, uint, uint);
function getStats() external view returns(uint numArbBlock,
uint numAcct,
uint totalStorageAlloc,
uint totalArbGasUsed,
uint numTxReceipt,
uint numContract);
}

4 changes: 2 additions & 2 deletions contracts/arbos/builtin/ArbSys.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ interface ArbSys {
* @notice Send a transaction to L1
* @param destination recipient address on L1
* @param calldataForL1 (optional) calldata for L1 contract call
* @return a unique identifier for this L2-to-L1 transaction.
* @return uniqueId a unique identifier for this L2-to-L1 transaction.
*/
function sendTxToL1(address destination, bytes calldata calldataForL1) external payable returns(uint);
function sendTxToL1(address destination, bytes calldata calldataForL1) external payable returns(uint uniqueId);

/**
* @notice get the number of transactions issued by the given external account or the account sequence number of the given contract
Expand Down