Skip to content

Commit

Permalink
Release 0.11.1-gm1
Browse files Browse the repository at this point in the history
  • Loading branch information
gmart7t2 committed Nov 14, 2023
2 parents 19db94a + b9d35b3 commit b42a67f
Show file tree
Hide file tree
Showing 17 changed files with 904 additions and 21 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ defaults:
run:
shell: bash

permissions:
contents: write

jobs:
release:
strategy:
Expand Down Expand Up @@ -54,7 +57,7 @@ jobs:
- name: Release Type
id: release-type
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+[.][0-9]+[.][0-9]+$ ]]; then
if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+[.][0-9]+[.][0-9]+(-gms?[0-9]+)?$ ]]; then
echo ::set-output name=value::release
else
echo ::set-output name=value::prerelease
Expand Down
107 changes: 107 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

[0.11.1-gm1](https://github.com/gmart7t2/ord/releases/tag/0.11.1-gm1) - 2023-11-14
----------------------------------------------------------------------------------

### Added
- Merged my changes from 0.11.0 to 0.11.1.

[0.11.1](https://github.com/ordinals/ord/releases/tag/0.11.1) - 2023-11-09
--------------------------------------------------------------------------

Expand All @@ -10,6 +16,23 @@ Changelog
### Misc
- Refactor varint encoding (#2645)

[0.11.0-gm2](https://github.com/gmart7t2/ord/releases/tag/0.11.0-gm2) - 2023-11-14
----------------------------------------------------------------------------------

### Added
- Add logging for new server endpoints.
- Add ord version to `/stats` endpoint output.

### Changed
- Move server debug logging to debug level.
- Remove `children` subcommand and replace it with `/children` server endpoint.

[0.11.0-gm1](https://github.com/gmart7t2/ord/releases/tag/0.11.0-gm1) - 2023-11-09
----------------------------------------------------------------------------------

### Added
- Merged my changes from 0.10.x to 0.11.x.

[0.11.0](https://github.com/ordinals/ord/releases/tag/0.11.0) - 2023-11-07
--------------------------------------------------------------------------

Expand Down Expand Up @@ -51,6 +74,18 @@ Changelog
- Ignore non push opcodes in runestones (#2553)
- Improve rune minimum at height (#2546)

[0.10.0-gm2](https://github.com/gmart7t2/ord/releases/tag/0.10.0-gm2) - 2023-11-03
----------------------------------------------------------------------------------

### Added
- Add `--address-type` flag to `wallet create` and `wallet restore`.

[0.10.0-gm1](https://github.com/gmart7t2/ord/releases/tag/0.10.0-gm1) - 2023-10-25
----------------------------------------------------------------------------------

### Added
- Merged my changes from 0.9.x to 0.10.x.

[0.10.0](https://github.com/ordinals/ord/releases/tag/0.10.0) - 2023-10-23
--------------------------------------------------------------------------

Expand Down Expand Up @@ -124,6 +159,78 @@ Changelog
- Format rune supply using divisibility (#2509)
- Add pre-alpha unstable incomplete half-baked rune index (#2491)

[0.9.0-gm5](https://github.com/ordinals/ord/releases/tag/0.9.0-gm5) - 2023-10-21
--------------------------------------------------------------------------------

### Added

- Add `/outputs` endpoint to fetch details for multiple outputs per request.

[0.9.0-gm4](https://github.com/ordinals/ord/releases/tag/0.9.0-gm4) - 2023-10-18
--------------------------------------------------------------------------------

### Added

- Add `/transfers/<height>/<start>` and `/transfers/<height>/<start>/<end>` endpoints to allow pagination.

[0.9.0-gm3](https://github.com/ordinals/ord/releases/tag/0.9.0-gm3) - 2023-10-10
--------------------------------------------------------------------------------

### Changed

- Modify the /ranges endpoint to group the ranges by output.

[0.9.0-gm2](https://github.com/ordinals/ord/releases/tag/0.9.0-gm2) - 2023-10-10
--------------------------------------------------------------------------------

### Changed

- Fix github releases.

[0.9.0-gm1](https://github.com/ordinals/ord/releases/tag/0.9.0-gm1) - 2023-10-10
--------------------------------------------------------------------------------

### Added

- Add `--ignore-descriptors` flag to allow ord to work with non-ord wallets.

[0.9.0-gms4](https://github.com/ordinals/ord/releases/tag/0.9.0-gms4) - 2023-09-18
----------------------------------------------------------------------------------

### Added

- Speed up `/transfers/` endpoint and don't block while running it.
- Add `application/cbor` media type with extension `.cbor` (#2446)
- Add --utxo flag to allow the use of unconfirmed outputs.
- Add --coin-control flag to limit which outputs can be spent.
- Add `/ranges` endpoint for looking up the sat ranges for a batch of outputs.

[0.9.0-gms3](https://github.com/ordinals/ord/releases/tag/0.9.0-gms3) - 2023-09-12
----------------------------------------------------------------------------------

### Added

- Add subcommand `children` to list all the child/parent pairs

[0.9.0-gms2](https://github.com/ordinals/ord/releases/tag/0.9.0-gms2) - 2023-09-11
----------------------------------------------------------------------------------

### Added

- Add `parent` and `children` to `/inscriptions_json/` endpoint

[0.9.0-gms1](https://github.com/ordinals/ord/releases/tag/0.9.0-gms1) - 2023-09-11
----------------------------------------------------------------------------------

### Added

- Add `/inscriptions_json/` endpoint
- Add `/transfers/` endpoint
- Add `/stats/` endpoint
- Only index blocks when new blocks exist and the height limit isn't reached
- Add `--no-progress-bar` flag to inhibit the display of the progress bar
- Add server request logging

[0.9.0](https://github.com/ordinals/ord/releases/tag/0.9.0) - 2023-09-11
------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ord"
description = "◉ Ordinal wallet and block explorer"
version = "0.11.1"
version = "0.11.1-gm1"
license = "CC0-1.0"
edition = "2021"
autotests = false
Expand Down
133 changes: 132 additions & 1 deletion src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ macro_rules! define_multimap_table {
define_multimap_table! { INSCRIPTION_ID_TO_CHILDREN, &InscriptionIdValue, &InscriptionIdValue }
define_multimap_table! { SATPOINT_TO_INSCRIPTION_ID, &SatPointValue, &InscriptionIdValue }
define_multimap_table! { SAT_TO_INSCRIPTION_ID, u64, &InscriptionIdValue }
define_multimap_table! { HEIGHT_TO_INSCRIPTION_ID, u64, &InscriptionIdValue }
define_table! { HEIGHT_TO_BLOCK_HASH, u64, &BlockHashValue }
define_table! { HEIGHT_TO_LAST_SEQUENCE_NUMBER, u64, u64 }
define_table! { INSCRIPTION_ID_TO_INSCRIPTION_ENTRY, &InscriptionIdValue, InscriptionEntryValue }
Expand Down Expand Up @@ -160,6 +161,7 @@ pub(crate) struct Index {
height_limit: Option<u64>,
index_runes: bool,
index_sats: bool,
no_progress_bar: bool,
options: Options,
path: PathBuf,
unrecoverably_reorged: AtomicBool,
Expand Down Expand Up @@ -272,6 +274,7 @@ impl Index {
tx.open_multimap_table(INSCRIPTION_ID_TO_CHILDREN)?;
tx.open_multimap_table(SATPOINT_TO_INSCRIPTION_ID)?;
tx.open_multimap_table(SAT_TO_INSCRIPTION_ID)?;
tx.open_multimap_table(HEIGHT_TO_INSCRIPTION_ID)?;
tx.open_table(HEIGHT_TO_BLOCK_HASH)?;
tx.open_table(HEIGHT_TO_LAST_SEQUENCE_NUMBER)?;
tx.open_table(INSCRIPTION_ID_TO_INSCRIPTION_ENTRY)?;
Expand Down Expand Up @@ -323,6 +326,7 @@ impl Index {
first_inscription_height: options.first_inscription_height(),
genesis_block_coinbase_transaction,
height_limit: options.height_limit,
no_progress_bar: options.no_progress_bar,
options: options.clone(),
index_runes,
index_sats,
Expand Down Expand Up @@ -793,7 +797,6 @@ impl Index {
self.client.get_block(&hash).into_option()
}

#[cfg(test)]
pub(crate) fn get_children_by_inscription_id(
&self,
inscription_id: InscriptionId,
Expand Down Expand Up @@ -865,6 +868,23 @@ impl Index {
)
}

pub(crate) fn get_inscription_ids_by_height(&self, height: u64) -> Result<Vec<InscriptionId>> {
let mut ret = Vec::new();
for range in self
.database
.begin_read()?
.open_multimap_table(HEIGHT_TO_INSCRIPTION_ID)?
.range::<&u64>(&height..&(height + 1))?
{
let (_, ids) = range?;
for id in ids {
ret.push(Entry::load(*id?.value()));
}
}

Ok(ret)
}

pub(crate) fn get_inscription_ids_by_sat(&self, sat: Sat) -> Result<Vec<InscriptionId>> {
let rtx = &self.database.begin_read()?;

Expand Down Expand Up @@ -1151,6 +1171,18 @@ impl Index {
}
}

pub(crate) fn ranges(&self, outpoint: OutPoint) -> Result<Vec<(u64, u64)>> {
match self.list_inner(outpoint.store())? {
Some(sat_ranges) =>
Ok(sat_ranges
.chunks_exact(11)
.map(|chunk| SatRange::load(chunk.try_into().unwrap()))
.collect(),
),
None => Err(anyhow!("no ranges")),
}
}

pub(crate) fn block_time(&self, height: Height) -> Result<Blocktime> {
let height = height.n();

Expand Down Expand Up @@ -1336,6 +1368,105 @@ impl Index {
)
}

pub(crate) fn delete_transfer_log(&self) -> Result {
let wtx = self.database.begin_write().unwrap();
wtx.delete_multimap_table(HEIGHT_TO_INSCRIPTION_ID)?;
Ok(wtx.commit()?)
}

pub(crate) fn trim_transfer_log(&self, height: u64) -> Result {
let wtx = self.begin_write()?;
for pair in self
.database
.begin_read()?
.open_multimap_table(HEIGHT_TO_INSCRIPTION_ID)?
.range(..height)?
{
wtx
.open_multimap_table(HEIGHT_TO_INSCRIPTION_ID)?
.remove_all(pair?.0.value())?;
}
Ok(wtx.commit()?)
}

pub(crate) fn show_transfer_log_stats(&self) -> Result<(u64, Option<u64>, Option<u64>)> {
let rtx = self.database.begin_read().unwrap();
let table = rtx.open_multimap_table(HEIGHT_TO_INSCRIPTION_ID)?;
let mut iter = table.iter()?;

let rows = table.len()?;

let first = iter
.next()
.and_then(|result| result.ok())
.map(|(height, _id)| height.value());

let last = iter
.next_back()
.and_then(|result| result.ok())
.map(|(height, _id)| height.value());

if first.is_none() {
Ok((rows, None, None))
} else if last.is_none() {
Ok((rows, first, first))
} else {
Ok((rows, first, last))
}
}

pub(crate) fn get_children(&self) -> Result<Vec<(InscriptionId, InscriptionId)>> {
let mut result = Vec::new();
for range in self
.database
.begin_read()?
.open_multimap_table(INSCRIPTION_ID_TO_CHILDREN)?
.iter()?
{
let (parent, children) = range?;
let parent = <InscriptionId as Entry>::load(*parent.value());
for child in children {
result.push((parent, <InscriptionId as Entry>::load(*child?.value())));
}
}

Ok(result)
}

pub(crate) fn get_stats(&self) -> Result<(Option<u64>, Option<i64>, Option<i64>)> {
let rtx = self.database.begin_read().unwrap();

let height = rtx
.open_table(HEIGHT_TO_BLOCK_HASH)?
.iter()?
.next_back()
.and_then(|result| result.ok())
.map(|(height, _hash)| height.value());

let table = rtx.open_table(INSCRIPTION_NUMBER_TO_INSCRIPTION_ID)?;
let mut iter = table.iter()?;

let lowest_number = iter
.next()
.and_then(|result| result.ok())
.map(|(number, _id)| number.value());

let highest_number = iter
.next_back()
.and_then(|result| result.ok())
.map(|(number, _id)| number.value());

Ok((
height,
lowest_number,
if highest_number.is_none() {
lowest_number
} else {
highest_number
},
))
}

#[cfg(test)]
fn assert_inscription_location(
&self,
Expand Down
Loading

0 comments on commit b42a67f

Please sign in to comment.