Skip to content

Commit

Permalink
feat(satp-hermes): fabric and besu bridges, wrapper contracts with on…
Browse files Browse the repository at this point in the history
…tology (#3382)

feat(satp-hermes): added forge to compile solidity contracts

Signed-off-by: Carlos Amaro <[email protected]>
  • Loading branch information
LordKubaya authored and rafaelbelchiorbd committed Jul 24, 2024
1 parent 627c544 commit b216275
Show file tree
Hide file tree
Showing 76 changed files with 15,375 additions and 3,567 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"PrivacyPolicyOpts": {
"description": "identifier of the policy used to process a view",
"type": "string",
"enum": ["pruneState"],
"x-enum-varnames": ["PruneState"]
"enum": ["pruneState", "singleTransaction"],
"x-enum-varnames": ["PruneState", "SingleTransaction"]
},
"MergePolicyOpts": {
"description": "identifier of the policy used to merge views (can be none)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ export interface MergeViewsResponse {
*/

export const PrivacyPolicyOpts = {
PruneState: 'pruneState'
PruneState: 'pruneState',
SingleTransaction: 'singleTransaction'
} as const;

export type PrivacyPolicyOpts = typeof PrivacyPolicyOpts[keyof typeof PrivacyPolicyOpts];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,24 @@ export class PrivacyPolicies {
return view;
}

public singleTransaction(
view: View,
stateId: string,
transactionId: string,
): View {
const snapshot = view.getSnapshot();
snapshot.filterTransaction(stateId, transactionId);
return view;
}

public getPrivacyPolicy(opts: PrivacyPolicyOpts): IPrivacyPolicy | undefined {
switch (opts) {
case PrivacyPolicyOpts.PruneState:
return this.pruneState;
break;
case PrivacyPolicyOpts.SingleTransaction:
return this.singleTransaction;
break;
default:
return undefined;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,22 @@ export class Snapshot {
this.stateBins = stateBins;
}

public selectStates(states: string[]): void {
const stateBins: State[] = [];
for (const state of this.stateBins) {
if (states.includes(state.getId())) {
stateBins.push(state);
}
}
this.stateBins = stateBins;
}

public filterTransaction(stateId: string, transaction: string): void {
this.selectStates([stateId]);
const state = this.stateBins[0];
state.selectTransactions([transaction]);
}

public getSnapshotJson(): string {
const snapshotJson = {
id: this.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ export class State {
return this.transactions;
}

public selectTransactions(txs: string[]): void {
const transactions: Transaction[] = [];
for (const tx of this.transactions) {
if (txs.includes(tx.getId())) {
transactions.push(tx);
}
}
this.transactions = transactions;
}

public getInitialTime(): string {
if (this.transactions.length >= 1) {
return this.transactions[0].getTimeStamp();
Expand Down
1 change: 1 addition & 0 deletions packages/cactus-plugin-satp-hermes/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ src/main/typescript/generated/gateway-client/typescript-axios/.openapi-generator
src/main/typescript/generated/gateway-client/typescript-axios/api.ts
src/main/typescript/generated/gateway-client/typescript-axios/git_push.sh
src/main/typescript/generated/gateway-client/typescript-axios/.openapi-generator/FILES
src/main/typescript/fabric-contracts/satp/chaincode-typescript/.yarn/
3 changes: 3 additions & 0 deletions packages/cactus-plugin-satp-hermes/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[profile.default]
solc-version = "0.8.20"
evm-version = "paris"
Loading

0 comments on commit b216275

Please sign in to comment.