ox 1.8.12 → 1.8.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/core/TxEnvelope.d.ts.map +1 -1
  3. package/dist/core/TxEnvelope.js +5 -3
  4. package/dist/core/TxEnvelope.js.map +1 -1
  5. package/dist/core/TxEnvelopeEip1559.d.ts.map +1 -1
  6. package/dist/core/TxEnvelopeEip1559.js +6 -2
  7. package/dist/core/TxEnvelopeEip1559.js.map +1 -1
  8. package/dist/core/TxEnvelopeEip4844.d.ts.map +1 -1
  9. package/dist/core/TxEnvelopeEip4844.js +4 -0
  10. package/dist/core/TxEnvelopeEip4844.js.map +1 -1
  11. package/dist/core/TxEnvelopeEip7702.d.ts.map +1 -1
  12. package/dist/core/TxEnvelopeEip7702.js +4 -0
  13. package/dist/core/TxEnvelopeEip7702.js.map +1 -1
  14. package/dist/core/TypedData.d.ts +8 -1
  15. package/dist/core/TypedData.d.ts.map +1 -1
  16. package/dist/core/TypedData.js +51 -14
  17. package/dist/core/TypedData.js.map +1 -1
  18. package/dist/core/internal/abiItem.d.ts.map +1 -1
  19. package/dist/core/internal/abiItem.js +44 -13
  20. package/dist/core/internal/abiItem.js.map +1 -1
  21. package/dist/core/internal/abiParameters.d.ts +2 -2
  22. package/dist/core/internal/abiParameters.d.ts.map +1 -1
  23. package/dist/core/internal/abiParameters.js +24 -7
  24. package/dist/core/internal/abiParameters.js.map +1 -1
  25. package/dist/core/internal/rpcSchemas/eth.d.ts +3 -2
  26. package/dist/core/internal/rpcSchemas/eth.d.ts.map +1 -1
  27. package/dist/tempo/KeyAuthorization.d.ts +21 -6
  28. package/dist/tempo/KeyAuthorization.d.ts.map +1 -1
  29. package/dist/tempo/KeyAuthorization.js +7 -4
  30. package/dist/tempo/KeyAuthorization.js.map +1 -1
  31. package/dist/tempo/TxEnvelopeTempo.d.ts.map +1 -1
  32. package/dist/tempo/TxEnvelopeTempo.js +6 -2
  33. package/dist/tempo/TxEnvelopeTempo.js.map +1 -1
  34. package/package.json +5 -2
  35. package/src/core/TxEnvelope.ts +5 -3
  36. package/src/core/TxEnvelopeEip1559.ts +8 -2
  37. package/src/core/TxEnvelopeEip4844.ts +6 -0
  38. package/src/core/TxEnvelopeEip7702.ts +6 -0
  39. package/src/core/TypedData.ts +57 -13
  40. package/src/core/_test/AbiItem.test.ts +238 -4
  41. package/src/core/_test/AbiParameters.decode.test.ts +140 -1
  42. package/src/core/_test/RpcSchema.test-d.ts +23 -1
  43. package/src/core/_test/TransactionEnvelopeEip1559.test.ts +24 -0
  44. package/src/core/_test/TransactionEnvelopeEip4844.test.ts +13 -0
  45. package/src/core/_test/TransactionEnvelopeEip7702.test.ts +13 -0
  46. package/src/core/_test/TypedData.test.ts +188 -1
  47. package/src/core/internal/abiItem.ts +48 -17
  48. package/src/core/internal/abiParameters.ts +26 -8
  49. package/src/core/internal/rpcSchemas/eth.ts +2 -1
  50. package/src/tempo/KeyAuthorization.test.ts +6 -4
  51. package/src/tempo/KeyAuthorization.ts +26 -8
  52. package/src/tempo/TxEnvelopeTempo.test.ts +26 -0
  53. package/src/tempo/TxEnvelopeTempo.ts +8 -2
  54. package/src/tempo/e2e.test.ts +73 -17
  55. package/src/version.ts +1 -1
@@ -2807,14 +2807,10 @@ describe('behavior: keyAuthorization', () => {
2807
2807
  },
2808
2808
  )
2809
2809
 
2810
- // TIP-1049 admin keys are not yet in any released tempo tag (only on
2811
- // `main` via PR #4265). CI runs the localnet job against the `edge`
2812
- // image which tracks main; devnet/testnet still ship the older
2813
- // release and would reject the 9-field wire format with
2814
- // `failed to decode signed transaction`.
2815
- // TODO: remove skipIf when devnet/testnet have T6 (TIP-1049).
2810
+ // TIP-1137 removes TIP-1049 admin keys at T14. The localnet job runs the
2811
+ // `edge` image, which has T14 active; devnet/testnet may not.
2816
2812
  test.skipIf(nodeEnv !== 'localnet')(
2817
- 'behavior: TIP-1049 admin access key round-trips through registration',
2813
+ 'behavior: TIP-1137 rejects an admin key authorization',
2818
2814
  async () => {
2819
2815
  const accessPrivateKey = Secp256k1.randomPrivateKey()
2820
2816
  const accessAddress = Address.fromPublicKey(
@@ -2822,8 +2818,8 @@ describe('behavior: keyAuthorization', () => {
2822
2818
  )
2823
2819
 
2824
2820
  const keyAuth = KeyAuthorization.from({
2825
- address: accessAddress,
2826
2821
  account: root.address,
2822
+ address: accessAddress,
2827
2823
  chainId: BigInt(chainId),
2828
2824
  isAdmin: true,
2829
2825
  type: 'secp256k1',
@@ -2847,15 +2843,79 @@ describe('behavior: keyAuthorization', () => {
2847
2843
  calls: [{ to: '0x0000000000000000000000000000000000000000' }],
2848
2844
  chainId,
2849
2845
  feeToken: '0x20c0000000000000000000000000000000000001',
2846
+ gas: 1_000_000n,
2850
2847
  keyAuthorization: keyAuth_signed,
2848
+ maxFeePerGas: Value.fromGwei('20'),
2849
+ maxPriorityFeePerGas: Value.fromGwei('10'),
2851
2850
  nonce: BigInt(nonce),
2851
+ })
2852
+
2853
+ const signature = Secp256k1.sign({
2854
+ payload: TxEnvelopeTempo.getSignPayload(transaction, {
2855
+ from: root.address,
2856
+ }),
2857
+ privateKey: accessPrivateKey,
2858
+ })
2859
+
2860
+ const serialized_signed = TxEnvelopeTempo.serialize(transaction, {
2861
+ signature: SignatureEnvelope.from({
2862
+ inner: SignatureEnvelope.from(signature),
2863
+ type: 'keychain',
2864
+ userAddress: root.address,
2865
+ }),
2866
+ })
2867
+
2868
+ // From T14 no path can set `is_admin = true`.
2869
+ await expect(
2870
+ client.request({
2871
+ method: 'eth_sendRawTransactionSync',
2872
+ params: [serialized_signed],
2873
+ }),
2874
+ ).rejects.toThrow('InvalidKeyId')
2875
+ },
2876
+ )
2877
+
2878
+ test.skipIf(nodeEnv !== 'localnet')(
2879
+ 'behavior: account-bound key authorization round-trips through registration',
2880
+ async () => {
2881
+ const accessPrivateKey = Secp256k1.randomPrivateKey()
2882
+ const accessAddress = Address.fromPublicKey(
2883
+ Secp256k1.getPublicKey({ privateKey: accessPrivateKey }),
2884
+ )
2885
+
2886
+ // From T14 an `account` binding must equal the transaction sender.
2887
+ const keyAuth = KeyAuthorization.from({
2888
+ account: root.address,
2889
+ address: accessAddress,
2890
+ chainId: BigInt(chainId),
2891
+ type: 'secp256k1',
2892
+ })
2893
+
2894
+ const keyAuth_signed = KeyAuthorization.from(keyAuth, {
2895
+ signature: SignatureEnvelope.from(
2896
+ Secp256k1.sign({
2897
+ payload: KeyAuthorization.getSignPayload(keyAuth),
2898
+ privateKey: root.privateKey,
2899
+ }),
2900
+ ),
2901
+ })
2902
+
2903
+ const nonce = await getTransactionCount(client, {
2904
+ address: root.address,
2905
+ blockTag: 'pending',
2906
+ })
2907
+
2908
+ const transaction = TxEnvelopeTempo.from({
2909
+ calls: [{ to: '0x0000000000000000000000000000000000000000' }],
2910
+ chainId,
2911
+ feeToken: '0x20c0000000000000000000000000000000000001',
2852
2912
  gas: 1_000_000n,
2913
+ keyAuthorization: keyAuth_signed,
2853
2914
  maxFeePerGas: Value.fromGwei('20'),
2854
2915
  maxPriorityFeePerGas: Value.fromGwei('10'),
2916
+ nonce: BigInt(nonce),
2855
2917
  })
2856
2918
 
2857
- // The admin access key signs and authorizes itself in the same tx
2858
- // (the canonical "auth+use" registration pattern).
2859
2919
  const signature = Secp256k1.sign({
2860
2920
  payload: TxEnvelopeTempo.getSignPayload(transaction, {
2861
2921
  from: root.address,
@@ -2865,9 +2925,9 @@ describe('behavior: keyAuthorization', () => {
2865
2925
 
2866
2926
  const serialized_signed = TxEnvelopeTempo.serialize(transaction, {
2867
2927
  signature: SignatureEnvelope.from({
2868
- userAddress: root.address,
2869
2928
  inner: SignatureEnvelope.from(signature),
2870
2929
  type: 'keychain',
2930
+ userAddress: root.address,
2871
2931
  }),
2872
2932
  })
2873
2933
 
@@ -2887,12 +2947,8 @@ describe('behavior: keyAuthorization', () => {
2887
2947
  .then((tx) => Transaction.fromRpc(tx as any))
2888
2948
  if (!response) throw new Error()
2889
2949
 
2890
- // isAdmin + account must survive the round trip through the node.
2891
- expect(response.keyAuthorization?.isAdmin).toBe(true)
2950
+ expect(response.keyAuthorization?.isAdmin).toBeUndefined()
2892
2951
  expect(response.keyAuthorization?.account).toBe(root.address)
2893
-
2894
- // The signing hash of the round-tripped authorization equals the
2895
- // admin-bearing hash.
2896
2952
  expect(KeyAuthorization.hash(response.keyAuthorization!)).toBe(
2897
2953
  KeyAuthorization.hash(keyAuth_signed),
2898
2954
  )
@@ -2901,7 +2957,7 @@ describe('behavior: keyAuthorization', () => {
2901
2957
 
2902
2958
  // TODO: remove skipIf when devnet/testnet have T6.
2903
2959
  test.skipIf(nodeEnv !== 'localnet')(
2904
- 'behavior: TIP-1049 non-admin authorization is byte-equivalent to pre-TIP-1049',
2960
+ 'behavior: unbound authorization is byte-equivalent to pre-TIP-1049',
2905
2961
  async () => {
2906
2962
  const accessPrivateKey = Secp256k1.randomPrivateKey()
2907
2963
  const accessAddress = Address.fromPublicKey(
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** @internal */
2
- export const version = '1.8.12'
2
+ export const version = '1.8.13'