Skip to content

Commit

Permalink
Merge branch 'master' into txid-api
Browse files Browse the repository at this point in the history
  • Loading branch information
algochoi committed Aug 8, 2023
2 parents 20604e2 + 4dc3f92 commit aad531d
Show file tree
Hide file tree
Showing 33 changed files with 746 additions and 511 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,11 @@ build: buildsrc buildsrc-special
# get around a bug in go build where it will fail
# to cache binaries from time to time on empty NFS
# dirs
buildsrc: check-go-version crypto/libs/$(OS_TYPE)/$(ARCH)/lib/libsodium.a node_exporter NONGO_BIN
mkdir -p "${GOCACHE}" && \
touch "${GOCACHE}"/file.txt && \
${GOCACHE}/file.txt:
mkdir -p "${GOCACHE}"
touch "${GOCACHE}"/file.txt

buildsrc: check-go-version crypto/libs/$(OS_TYPE)/$(ARCH)/lib/libsodium.a node_exporter NONGO_BIN ${GOCACHE}/file.txt
go install $(GOTRIMPATH) $(GOTAGS) $(GOBUILDMODE) -ldflags="$(GOLDFLAGS)" ./...

buildsrc-special:
Expand Down
5 changes: 5 additions & 0 deletions cmd/pingpong/runCmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ var generatedAccountsOffset uint64
var generatedAccountSampleMethod string
var configPath string
var latencyPath string
var asyncSending bool

func init() {
rootCmd.AddCommand(runCmd)
Expand Down Expand Up @@ -132,6 +133,7 @@ func init() {
runCmd.Flags().BoolVar(&randomLease, "randomlease", false, "set the lease to contain a random value")
runCmd.Flags().BoolVar(&rekey, "rekey", false, "Create RekeyTo transactions. Requires groupsize=2 and any of random flags exc random dst")
runCmd.Flags().Uint32Var(&duration, "duration", 0, "The number of seconds to run the pingpong test, forever if 0")
runCmd.Flags().BoolVar(&asyncSending, "async", false, "Use async sending mode")
runCmd.Flags().Uint32Var(&nftAsaPerSecond, "nftasapersecond", 0, "The number of NFT-style ASAs to create per second")
runCmd.Flags().StringVar(&pidFile, "pidfile", "", "path to write process id of this pingpong")
runCmd.Flags().StringVar(&cpuprofile, "cpuprofile", "", "write cpu profile to `file`")
Expand Down Expand Up @@ -294,6 +296,9 @@ var runCmd = &cobra.Command{
if duration > 0 {
cfg.MaxRuntime = time.Duration(uint32(duration)) * time.Second
}
if asyncSending {
cfg.AsyncSending = true
}
if randomNote {
cfg.RandomNote = true
}
Expand Down
59 changes: 59 additions & 0 deletions daemon/algod/api/algod.oas2.json
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,65 @@
}
}
},
"/v2/transactions/async": {
"post": {
"tags": [
"experimental"
],
"consumes": [
"application/x-binary"
],
"schemes": [
"http"
],
"summary": "Fast track for broadcasting a raw transaction or transaction group to the network through the tx handler without performing most of the checks and reporting detailed errors. Should be only used for development and performance testing.",
"operationId": "RawTransactionAsync",
"parameters": [
{
"description": "The byte encoded signed transaction to broadcast to network",
"name": "rawtxn",
"in": "body",
"required": true,
"schema": {
"type": "string",
"format": "binary"
}
}
],
"responses": {
"200": {
"type": "object"
},
"400": {
"description": "Bad Request - Malformed Algorand transaction ",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"401": {
"description": "Invalid API Token",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"500": {
"description": "Internal Error",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"503": {
"description": "Service Temporarily Unavailable",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"default": {
"description": "Unknown Error"
}
}
}
},
"/v2/transactions/simulate": {
"post": {
"tags": [
Expand Down
71 changes: 71 additions & 0 deletions daemon/algod/api/algod.oas3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6176,6 +6176,77 @@
"x-codegen-request-body-name": "rawtxn"
}
},
"/v2/transactions/async": {
"post": {
"operationId": "RawTransactionAsync",
"requestBody": {
"content": {
"application/x-binary": {
"schema": {
"format": "binary",
"type": "string"
}
}
},
"description": "The byte encoded signed transaction to broadcast to network",
"required": true
},
"responses": {
"200": {
"content": {}
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Bad Request - Malformed Algorand transaction "
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Invalid API Token"
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Error"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Service Temporarily Unavailable"
},
"default": {
"content": {},
"description": "Unknown Error"
}
},
"summary": "Fast track for broadcasting a raw transaction or transaction group to the network through the tx handler without performing most of the checks and reporting detailed errors. Should be only used for development and performance testing.",
"tags": [
"experimental"
],
"x-codegen-request-body-name": "rawtxn"
}
},
"/v2/transactions/params": {
"get": {
"operationId": "TransactionParams",
Expand Down
7 changes: 7 additions & 0 deletions daemon/algod/api/client/restClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
// rawRequestPaths is a set of paths where the body should not be urlencoded
var rawRequestPaths = map[string]bool{
"/v2/transactions": true,
"/v2/transactions/async": true,
"/v2/teal/dryrun": true,
"/v2/teal/compile": true,
"/v2/participation": true,
Expand Down Expand Up @@ -527,6 +528,12 @@ func (client RestClient) SendRawTransaction(txn transactions.SignedTxn) (respons
return
}

// SendRawTransactionAsync gets a SignedTxn and broadcasts it to the network
func (client RestClient) SendRawTransactionAsync(txn transactions.SignedTxn) (response model.PostTransactionsResponse, err error) {
err = client.post(&response, "/v2/transactions/async", nil, protocol.Encode(&txn), true)
return
}

// SendRawTransactionGroup gets a SignedTxn group and broadcasts it to the network
func (client RestClient) SendRawTransactionGroup(txgroup []transactions.SignedTxn) error {
// response is not terribly useful: it's the txid of the first transaction,
Expand Down
6 changes: 3 additions & 3 deletions daemon/algod/api/server/v2/generated/data/routes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit aad531d

Please sign in to comment.