@0xsequence/catapult 1.3.17 → 1.4.0

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 (124) hide show
  1. package/README.md +249 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +1 -0
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/index.d.ts +1 -0
  6. package/dist/commands/index.d.ts.map +1 -1
  7. package/dist/commands/index.js +1 -0
  8. package/dist/commands/index.js.map +1 -1
  9. package/dist/commands/list.d.ts.map +1 -1
  10. package/dist/commands/list.js +12 -0
  11. package/dist/commands/list.js.map +1 -1
  12. package/dist/commands/provenance.d.ts +3 -0
  13. package/dist/commands/provenance.d.ts.map +1 -0
  14. package/dist/commands/provenance.js +138 -0
  15. package/dist/commands/provenance.js.map +1 -0
  16. package/dist/lib/__tests__/deployer.spec.js +118 -1
  17. package/dist/lib/__tests__/deployer.spec.js.map +1 -1
  18. package/dist/lib/__tests__/provenance.spec.d.ts +2 -0
  19. package/dist/lib/__tests__/provenance.spec.d.ts.map +1 -0
  20. package/dist/lib/__tests__/provenance.spec.js +205 -0
  21. package/dist/lib/__tests__/provenance.spec.js.map +1 -0
  22. package/dist/lib/contracts/__tests__/repository.spec.js +243 -0
  23. package/dist/lib/contracts/__tests__/repository.spec.js.map +1 -1
  24. package/dist/lib/contracts/repository.d.ts +9 -1
  25. package/dist/lib/contracts/repository.d.ts.map +1 -1
  26. package/dist/lib/contracts/repository.js +93 -7
  27. package/dist/lib/contracts/repository.js.map +1 -1
  28. package/dist/lib/core/__tests__/assert-action.spec.d.ts +2 -0
  29. package/dist/lib/core/__tests__/assert-action.spec.d.ts.map +1 -0
  30. package/dist/lib/core/__tests__/assert-action.spec.js +377 -0
  31. package/dist/lib/core/__tests__/assert-action.spec.js.map +1 -0
  32. package/dist/lib/core/__tests__/engine.spec.js +80 -0
  33. package/dist/lib/core/__tests__/engine.spec.js.map +1 -1
  34. package/dist/lib/core/__tests__/loader.spec.js +29 -0
  35. package/dist/lib/core/__tests__/loader.spec.js.map +1 -1
  36. package/dist/lib/core/__tests__/resolver.spec.js +383 -0
  37. package/dist/lib/core/__tests__/resolver.spec.js.map +1 -1
  38. package/dist/lib/core/engine.d.ts.map +1 -1
  39. package/dist/lib/core/engine.js +33 -0
  40. package/dist/lib/core/engine.js.map +1 -1
  41. package/dist/lib/core/loader.d.ts +1 -0
  42. package/dist/lib/core/loader.d.ts.map +1 -1
  43. package/dist/lib/core/loader.js +6 -1
  44. package/dist/lib/core/loader.js.map +1 -1
  45. package/dist/lib/core/resolver.d.ts +2 -0
  46. package/dist/lib/core/resolver.d.ts.map +1 -1
  47. package/dist/lib/core/resolver.js +89 -0
  48. package/dist/lib/core/resolver.js.map +1 -1
  49. package/dist/lib/deployer.d.ts.map +1 -1
  50. package/dist/lib/deployer.js +21 -4
  51. package/dist/lib/deployer.js.map +1 -1
  52. package/dist/lib/index.d.ts +1 -0
  53. package/dist/lib/index.d.ts.map +1 -1
  54. package/dist/lib/index.js +1 -0
  55. package/dist/lib/index.js.map +1 -1
  56. package/dist/lib/parsers/__tests__/job.spec.js +77 -0
  57. package/dist/lib/parsers/__tests__/job.spec.js.map +1 -1
  58. package/dist/lib/parsers/__tests__/source.spec.d.ts +2 -0
  59. package/dist/lib/parsers/__tests__/source.spec.d.ts.map +1 -0
  60. package/dist/lib/parsers/__tests__/source.spec.js +121 -0
  61. package/dist/lib/parsers/__tests__/source.spec.js.map +1 -0
  62. package/dist/lib/parsers/index.d.ts +1 -0
  63. package/dist/lib/parsers/index.d.ts.map +1 -1
  64. package/dist/lib/parsers/index.js +1 -0
  65. package/dist/lib/parsers/index.js.map +1 -1
  66. package/dist/lib/parsers/job.d.ts.map +1 -1
  67. package/dist/lib/parsers/job.js +11 -0
  68. package/dist/lib/parsers/job.js.map +1 -1
  69. package/dist/lib/parsers/source.d.ts +4 -0
  70. package/dist/lib/parsers/source.d.ts.map +1 -0
  71. package/dist/lib/parsers/source.js +107 -0
  72. package/dist/lib/parsers/source.js.map +1 -0
  73. package/dist/lib/provenance.d.ts +34 -0
  74. package/dist/lib/provenance.d.ts.map +1 -0
  75. package/dist/lib/provenance.js +645 -0
  76. package/dist/lib/provenance.js.map +1 -0
  77. package/dist/lib/types/actions.d.ts +18 -2
  78. package/dist/lib/types/actions.d.ts.map +1 -1
  79. package/dist/lib/types/actions.js +1 -0
  80. package/dist/lib/types/actions.js.map +1 -1
  81. package/dist/lib/types/contracts.d.ts +3 -0
  82. package/dist/lib/types/contracts.d.ts.map +1 -1
  83. package/dist/lib/types/definitions.d.ts +1 -0
  84. package/dist/lib/types/definitions.d.ts.map +1 -1
  85. package/dist/lib/types/index.d.ts +1 -0
  86. package/dist/lib/types/index.d.ts.map +1 -1
  87. package/dist/lib/types/index.js +1 -0
  88. package/dist/lib/types/index.js.map +1 -1
  89. package/dist/lib/types/source.d.ts +24 -0
  90. package/dist/lib/types/source.d.ts.map +1 -0
  91. package/dist/lib/types/source.js +3 -0
  92. package/dist/lib/types/source.js.map +1 -0
  93. package/dist/lib/types/values.d.ts +33 -1
  94. package/dist/lib/types/values.d.ts.map +1 -1
  95. package/package.json +1 -1
  96. package/src/cli.ts +3 -2
  97. package/src/commands/index.ts +2 -1
  98. package/src/commands/list.ts +14 -1
  99. package/src/commands/provenance.ts +120 -0
  100. package/src/lib/__tests__/deployer.spec.ts +177 -1
  101. package/src/lib/__tests__/provenance.spec.ts +208 -0
  102. package/src/lib/contracts/__tests__/repository.spec.ts +270 -2
  103. package/src/lib/contracts/repository.ts +112 -14
  104. package/src/lib/core/__tests__/assert-action.spec.ts +474 -0
  105. package/src/lib/core/__tests__/engine.spec.ts +116 -0
  106. package/src/lib/core/__tests__/loader.spec.ts +34 -1
  107. package/src/lib/core/__tests__/resolver.spec.ts +444 -1
  108. package/src/lib/core/engine.ts +52 -0
  109. package/src/lib/core/loader.ts +8 -2
  110. package/src/lib/core/resolver.ts +116 -0
  111. package/src/lib/deployer.ts +28 -4
  112. package/src/lib/index.ts +4 -1
  113. package/src/lib/parsers/__tests__/job.spec.ts +81 -0
  114. package/src/lib/parsers/__tests__/source.spec.ts +134 -0
  115. package/src/lib/parsers/index.ts +1 -0
  116. package/src/lib/parsers/job.ts +14 -2
  117. package/src/lib/parsers/source.ts +129 -0
  118. package/src/lib/provenance.ts +785 -0
  119. package/src/lib/types/actions.ts +22 -1
  120. package/src/lib/types/contracts.ts +4 -1
  121. package/src/lib/types/definitions.ts +7 -0
  122. package/src/lib/types/index.ts +1 -0
  123. package/src/lib/types/source.ts +26 -0
  124. package/src/lib/types/values.ts +71 -0
@@ -68,8 +68,28 @@ export interface JsonRequestAction {
68
68
  };
69
69
  }
70
70
 
71
+ export interface AssertAction {
72
+ type: 'assert';
73
+ arguments: {
74
+ /** Source of the ACTUAL value: either `to`+`signature` (eth_call) or `actual` (a value). */
75
+ to?: AddressValue;
76
+ signature?: string;
77
+ values?: any[];
78
+ actual?: Value<any>;
79
+ /** Exactly one comparator key whose value is the EXPECTED value. */
80
+ eq?: Value<any>;
81
+ neq?: Value<any>;
82
+ gt?: Value<any>;
83
+ lt?: Value<any>;
84
+ gte?: Value<any>;
85
+ lte?: Value<any>;
86
+ /** Optional message for the error. */
87
+ message?: string;
88
+ };
89
+ }
90
+
71
91
  // A union of all primitive action types.
72
- export type PrimitiveAction = SendTransactionAction | SendSignedTransactionAction | VerifyContractAction | StaticAction | CreateContractAction | TestNicksMethodAction | JsonRequestAction;
92
+ export type PrimitiveAction = SendTransactionAction | SendSignedTransactionAction | VerifyContractAction | StaticAction | CreateContractAction | TestNicksMethodAction | JsonRequestAction | AssertAction;
73
93
 
74
94
  const primitiveActionTypes = [
75
95
  'send-transaction',
@@ -79,6 +99,7 @@ const primitiveActionTypes = [
79
99
  'create-contract',
80
100
  'test-nicks-method',
81
101
  'json-request',
102
+ 'assert',
82
103
  ] as const;
83
104
 
84
105
  /**
@@ -1,4 +1,5 @@
1
1
  import { CompilerInfo } from './artifacts'
2
+ import { SourceProvenance } from './source'
2
3
 
3
4
  export interface Contract {
4
5
  // The ultimate, unambiguous identifier
@@ -17,7 +18,9 @@ export interface Contract {
17
18
  // Compilation Information
18
19
  compiler?: CompilerInfo
19
20
  buildInfoId?: string // The ID from the build-info file it was found in
21
+ sourceProvenance?: SourceProvenance // Repository/ref/build metadata for the preferred build-info source
20
22
 
21
23
  // Internal Management - tracks all file paths from which this contract's data was hydrated
22
24
  _sources: Set<string>
23
- }
25
+ _sourceProvenance?: Map<string, SourceProvenance>
26
+ }
@@ -55,6 +55,13 @@ export interface Job {
55
55
  /** Minimum EVM hardfork required to run this job (e.g. "london", "paris", "shanghai", "cancun") */
56
56
  min_evm_version?: string
57
57
  skip_condition?: Condition[];
58
+ /**
59
+ * Pure gate conditions: if ANY condition is true, the job is skipped BEFORE execution.
60
+ * Unlike skip_condition, these are NOT post-execution-checked. Use this for jobs that
61
+ * generate artifacts (e.g., Safe/multisig transaction payloads) and should skip when
62
+ * already in desired state, without requiring convergence within the run.
63
+ */
64
+ skip_if?: Condition[];
58
65
  constants?: Record<string, Value<any>>; // Optional job-level constants
59
66
  deprecated?: boolean; // Optional flag to mark the job as deprecated
60
67
  _path?: string; // Path to the job file for relative artifact resolution
@@ -6,3 +6,4 @@ export * from './actions'
6
6
  export * from './definitions'
7
7
  export * from './artifacts'
8
8
  export * from './buildinfo'
9
+ export * from './source'
@@ -0,0 +1,26 @@
1
+ export interface SourceProvenance {
2
+ repo: string
3
+ ref?: string
4
+ commit?: string
5
+ build?: string
6
+ sourceDocumentPath?: string
7
+ buildInfoPath?: string
8
+ }
9
+
10
+ export interface SourceProvenanceOverride {
11
+ repo?: string
12
+ ref?: string
13
+ commit?: string
14
+ build?: string
15
+ }
16
+
17
+ export interface BuildInfoSourceProvenance extends SourceProvenance {
18
+ contracts?: Record<string, SourceProvenanceOverride>
19
+ }
20
+
21
+ export interface SourceDocument {
22
+ type: 'source'
23
+ build_info: Record<string, BuildInfoSourceProvenance>
24
+ warnings?: string[]
25
+ _path?: string
26
+ }
@@ -56,6 +56,75 @@ export interface ReadBalanceValue {
56
56
  };
57
57
  }
58
58
 
59
+ export interface GetStorageAtValue {
60
+ type: 'get-storage-at';
61
+ arguments: {
62
+ address: AddressValue;
63
+ slot: Value<string | number>;
64
+ };
65
+ }
66
+
67
+ /**
68
+ * Computes EVM storage slots for common Solidity storage layouts.
69
+ *
70
+ * The result is always returned as a 32-byte, 0x-prefixed lowercase hex string,
71
+ * so it can be fed directly into `get-storage-at` or nested as the `slot` of
72
+ * another `compute-slot` (e.g. for nested mappings).
73
+ */
74
+ export type ComputeSlotArguments =
75
+ | {
76
+ /** Value at `mapping[key]`: keccak256(h(key) . slot). */
77
+ kind: 'mapping';
78
+ /** Declaration slot of the mapping. */
79
+ slot: Value<string | number>;
80
+ /** The mapping key. */
81
+ key: Value<string | number | boolean>;
82
+ /**
83
+ * Solidity type of the key, used to encode it (default: "uint256").
84
+ * Value types (address, uint*, int*, bytes32, bool, ...) are ABI-encoded
85
+ * and left-padded; dynamic types ("string", "bytes") are packed.
86
+ */
87
+ keyType?: Value<string>;
88
+ }
89
+ | {
90
+ /** Element of a dynamic array: keccak256(slot) + index * elementSize. */
91
+ kind: 'dynamic-array';
92
+ /** Declaration slot of the array (also where its length lives). */
93
+ slot: Value<string | number>;
94
+ /** Element index (default: 0). */
95
+ index?: Value<string | number>;
96
+ /** Number of slots each element occupies (default: 1). */
97
+ elementSize?: Value<string | number>;
98
+ }
99
+ | {
100
+ /** Field of a struct or fixed-size array element: slot + offset. */
101
+ kind: 'struct-field';
102
+ /** Base slot of the struct / array element. */
103
+ slot: Value<string | number>;
104
+ /** Field offset in slots from the base. */
105
+ offset: Value<string | number>;
106
+ }
107
+ | {
108
+ /**
109
+ * ERC-7201 namespaced storage root:
110
+ * keccak256(abi.encode(uint256(keccak256(id)) - 1)) & ~bytes32(uint256(0xff)).
111
+ */
112
+ kind: 'erc7201';
113
+ /** The namespace id, e.g. "openzeppelin.storage.Ownable". */
114
+ id: Value<string>;
115
+ }
116
+ | {
117
+ /** Well-known EIP-1967 proxy slot: keccak256("eip1967.proxy.<name>") - 1. */
118
+ kind: 'eip1967';
119
+ /** Which proxy slot to compute. */
120
+ name: Value<'implementation' | 'admin' | 'beacon'>;
121
+ };
122
+
123
+ export interface ComputeSlotValue {
124
+ type: 'compute-slot';
125
+ arguments: ComputeSlotArguments;
126
+ }
127
+
59
128
  export interface BasicArithmeticValue {
60
129
  type: 'basic-arithmetic';
61
130
  arguments: {
@@ -127,6 +196,8 @@ export type ValueResolver =
127
196
  | ComputeCreateValue
128
197
  | ComputeCreate2Value
129
198
  | ReadBalanceValue
199
+ | GetStorageAtValue
200
+ | ComputeSlotValue
130
201
  | BasicArithmeticValue
131
202
  | CallValue
132
203
  | ContractExistsValue