Skip to content

Commit

Permalink
add no_send option
Browse files Browse the repository at this point in the history
  • Loading branch information
freigeistig committed Mar 8, 2024
1 parent 8732bb4 commit efbed28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ network:
verifier_address: ""
vault_address: "http://127.0.0.1:8200"
vault_mount_path: "secret_data"
no_send: false

log:
level: debug
Expand Down
2 changes: 2 additions & 0 deletions internal/config/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type NetworkConfig struct {
VotingRegistry common.Address `fig:"voting_registry,required"`
Address string `fig:"vault_address,required"`
MountPath string `fig:"vault_mount_path,required"`
NoSend bool `fig:"no_send"`

ChainID *big.Int `fig:"chain_id"`
Token string `dig:"VAULT_TOKEN,clear"`
Expand Down Expand Up @@ -79,6 +80,7 @@ func (e *ethereum) NetworkConfig() *NetworkConfig {
"voting_registry": result.VotingRegistry,
"vault_address": result.Address,
"vault_mount_path": result.MountPath,
"no_send": result.NoSend,
}).Now(); err != nil {
panic(err)
}
Expand Down
10 changes: 6 additions & 4 deletions internal/service/api/handlers/verify_proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ func VerifyProof(w http.ResponseWriter, r *http.Request) {
return
}

if err := EthClient(r).SendTransaction(r.Context(), tx); err != nil {
Log(r).WithError(err).Error("failed to send transaction")
ape.RenderErr(w, problems.InternalError())
return
if !NetworkConfig(r).NoSend {
if err := EthClient(r).SendTransaction(r.Context(), tx); err != nil {
Log(r).WithError(err).Error("failed to send transaction")
ape.RenderErr(w, problems.InternalError())
return
}
}

NetworkConfig(r).IncrementNonce()
Expand Down

0 comments on commit efbed28

Please sign in to comment.