Skip to content

Commit

Permalink
Update for koinos-proto commit c843b85
Browse files Browse the repository at this point in the history
  • Loading branch information
koinos-ci committed Jan 22, 2025
1 parent e895ce5 commit 2e4ebde
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 105 deletions.
38 changes: 37 additions & 1 deletion assembly/koinos/broadcast/broadcast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ export namespace broadcast {
writer.uint32(24);
writer.uint64(message.height);
}

if (message.system_disk_storage_used != 0) {
writer.uint32(32);
writer.uint64(message.system_disk_storage_used);
}

if (message.system_network_bandwidth_used != 0) {
writer.uint32(40);
writer.uint64(message.system_network_bandwidth_used);
}

if (message.system_compute_bandwidth_used != 0) {
writer.uint32(48);
writer.uint64(message.system_compute_bandwidth_used);
}
}

static decode(reader: Reader, length: i32): transaction_accepted {
Expand Down Expand Up @@ -52,6 +67,18 @@ export namespace broadcast {
message.height = reader.uint64();
break;

case 4:
message.system_disk_storage_used = reader.uint64();
break;

case 5:
message.system_network_bandwidth_used = reader.uint64();
break;

case 6:
message.system_compute_bandwidth_used = reader.uint64();
break;

default:
reader.skipType(tag & 7);
break;
Expand All @@ -64,15 +91,24 @@ export namespace broadcast {
transaction: protocol.transaction | null;
receipt: protocol.transaction_receipt | null;
height: u64;
system_disk_storage_used: u64;
system_network_bandwidth_used: u64;
system_compute_bandwidth_used: u64;

constructor(
transaction: protocol.transaction | null = null,
receipt: protocol.transaction_receipt | null = null,
height: u64 = 0
height: u64 = 0,
system_disk_storage_used: u64 = 0,
system_network_bandwidth_used: u64 = 0,
system_compute_bandwidth_used: u64 = 0
) {
this.transaction = transaction;
this.receipt = receipt;
this.height = height;
this.system_disk_storage_used = system_disk_storage_used;
this.system_network_bandwidth_used = system_network_bandwidth_used;
this.system_compute_bandwidth_used = system_compute_bandwidth_used;
}
}

Expand Down
119 changes: 99 additions & 20 deletions assembly/koinos/mempool/mempool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export namespace mempool {
}
}

export class pending_transaction_record {
static encode(message: pending_transaction_record, writer: Writer): void {
export class pending_transaction {
static encode(message: pending_transaction, writer: Writer): void {
const unique_name_transaction = message.transaction;
if (unique_name_transaction !== null) {
writer.uint32(10);
Expand All @@ -95,30 +95,40 @@ export namespace mempool {
writer.ldelim();
}

if (message.timestamp != 0) {
writer.uint32(16);
writer.uint64(message.timestamp);
}

if (message.disk_storage_used != 0) {
writer.uint32(24);
writer.uint32(16);
writer.uint64(message.disk_storage_used);
}

if (message.network_bandwidth_used != 0) {
writer.uint32(32);
writer.uint32(24);
writer.uint64(message.network_bandwidth_used);
}

if (message.compute_bandwidth_used != 0) {
writer.uint32(40);
writer.uint32(32);
writer.uint64(message.compute_bandwidth_used);
}

if (message.system_disk_storage_used != 0) {
writer.uint32(40);
writer.uint64(message.system_disk_storage_used);
}

if (message.system_network_bandwidth_used != 0) {
writer.uint32(48);
writer.uint64(message.system_network_bandwidth_used);
}

if (message.system_compute_bandwidth_used != 0) {
writer.uint32(56);
writer.uint64(message.system_compute_bandwidth_used);
}
}

static decode(reader: Reader, length: i32): pending_transaction_record {
static decode(reader: Reader, length: i32): pending_transaction {
const end: usize = length < 0 ? reader.end : reader.ptr + length;
const message = new pending_transaction_record();
const message = new pending_transaction();

while (reader.ptr < end) {
const tag = reader.uint32();
Expand All @@ -131,19 +141,27 @@ export namespace mempool {
break;

case 2:
message.timestamp = reader.uint64();
message.disk_storage_used = reader.uint64();
break;

case 3:
message.disk_storage_used = reader.uint64();
message.network_bandwidth_used = reader.uint64();
break;

case 4:
message.network_bandwidth_used = reader.uint64();
message.compute_bandwidth_used = reader.uint64();
break;

case 5:
message.compute_bandwidth_used = reader.uint64();
message.system_disk_storage_used = reader.uint64();
break;

case 6:
message.system_network_bandwidth_used = reader.uint64();
break;

case 7:
message.system_compute_bandwidth_used = reader.uint64();
break;

default:
Expand All @@ -156,23 +174,84 @@ export namespace mempool {
}

transaction: protocol.transaction | null;
timestamp: u64;
disk_storage_used: u64;
network_bandwidth_used: u64;
compute_bandwidth_used: u64;
system_disk_storage_used: u64;
system_network_bandwidth_used: u64;
system_compute_bandwidth_used: u64;

constructor(
transaction: protocol.transaction | null = null,
timestamp: u64 = 0,
disk_storage_used: u64 = 0,
network_bandwidth_used: u64 = 0,
compute_bandwidth_used: u64 = 0
compute_bandwidth_used: u64 = 0,
system_disk_storage_used: u64 = 0,
system_network_bandwidth_used: u64 = 0,
system_compute_bandwidth_used: u64 = 0
) {
this.transaction = transaction;
this.timestamp = timestamp;
this.disk_storage_used = disk_storage_used;
this.network_bandwidth_used = network_bandwidth_used;
this.compute_bandwidth_used = compute_bandwidth_used;
this.system_disk_storage_used = system_disk_storage_used;
this.system_network_bandwidth_used = system_network_bandwidth_used;
this.system_compute_bandwidth_used = system_compute_bandwidth_used;
}
}

export class pending_transaction_record {
static encode(message: pending_transaction_record, writer: Writer): void {
const unique_name_pending_transaction = message.pending_transaction;
if (unique_name_pending_transaction !== null) {
writer.uint32(10);
writer.fork();
pending_transaction.encode(unique_name_pending_transaction, writer);
writer.ldelim();
}

if (message.timestamp != 0) {
writer.uint32(16);
writer.uint64(message.timestamp);
}
}

static decode(reader: Reader, length: i32): pending_transaction_record {
const end: usize = length < 0 ? reader.end : reader.ptr + length;
const message = new pending_transaction_record();

while (reader.ptr < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.pending_transaction = pending_transaction.decode(
reader,
reader.uint32()
);
break;

case 2:
message.timestamp = reader.uint64();
break;

default:
reader.skipType(tag & 7);
break;
}
}

return message;
}

pending_transaction: pending_transaction | null;
timestamp: u64;

constructor(
pending_transaction: pending_transaction | null = null,
timestamp: u64 = 0
) {
this.pending_transaction = pending_transaction;
this.timestamp = timestamp;
}
}
}
92 changes: 8 additions & 84 deletions assembly/koinos/rpc/mempool/mempool_rpc.ts
Original file line number Diff line number Diff line change
@@ -1,87 +1,8 @@
import { Writer, Reader } from "as-proto";
import { protocol } from "../../protocol/protocol";
import { mempool } from "../../mempool/mempool";
import { rpc } from "../rpc";

export namespace mempool_rpc {
export class pending_transaction {
static encode(message: pending_transaction, writer: Writer): void {
const unique_name_transaction = message.transaction;
if (unique_name_transaction !== null) {
writer.uint32(10);
writer.fork();
protocol.transaction.encode(unique_name_transaction, writer);
writer.ldelim();
}

if (message.disk_storage_used != 0) {
writer.uint32(16);
writer.uint64(message.disk_storage_used);
}

if (message.network_bandwidth_used != 0) {
writer.uint32(24);
writer.uint64(message.network_bandwidth_used);
}

if (message.compute_bandwidth_used != 0) {
writer.uint32(32);
writer.uint64(message.compute_bandwidth_used);
}
}

static decode(reader: Reader, length: i32): pending_transaction {
const end: usize = length < 0 ? reader.end : reader.ptr + length;
const message = new pending_transaction();

while (reader.ptr < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.transaction = protocol.transaction.decode(
reader,
reader.uint32()
);
break;

case 2:
message.disk_storage_used = reader.uint64();
break;

case 3:
message.network_bandwidth_used = reader.uint64();
break;

case 4:
message.compute_bandwidth_used = reader.uint64();
break;

default:
reader.skipType(tag & 7);
break;
}
}

return message;
}

transaction: protocol.transaction | null;
disk_storage_used: u64;
network_bandwidth_used: u64;
compute_bandwidth_used: u64;

constructor(
transaction: protocol.transaction | null = null,
disk_storage_used: u64 = 0,
network_bandwidth_used: u64 = 0,
compute_bandwidth_used: u64 = 0
) {
this.transaction = transaction;
this.disk_storage_used = disk_storage_used;
this.network_bandwidth_used = network_bandwidth_used;
this.compute_bandwidth_used = compute_bandwidth_used;
}
}

export class check_pending_account_resources_request {
static encode(
message: check_pending_account_resources_request,
Expand Down Expand Up @@ -264,7 +185,10 @@ export namespace mempool_rpc {
for (let i = 0; i < unique_name_pending_transactions.length; ++i) {
writer.uint32(10);
writer.fork();
pending_transaction.encode(unique_name_pending_transactions[i], writer);
mempool.pending_transaction.encode(
unique_name_pending_transactions[i],
writer
);
writer.ldelim();
}
}
Expand All @@ -281,7 +205,7 @@ export namespace mempool_rpc {
switch (tag >>> 3) {
case 1:
message.pending_transactions.push(
pending_transaction.decode(reader, reader.uint32())
mempool.pending_transaction.decode(reader, reader.uint32())
);
break;

Expand All @@ -294,9 +218,9 @@ export namespace mempool_rpc {
return message;
}

pending_transactions: Array<pending_transaction>;
pending_transactions: Array<mempool.pending_transaction>;

constructor(pending_transactions: Array<pending_transaction> = []) {
constructor(pending_transactions: Array<mempool.pending_transaction> = []) {
this.pending_transactions = pending_transactions;
}
}
Expand Down

0 comments on commit 2e4ebde

Please sign in to comment.